EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: mapner on February 10, 2018, 09:36:26 AM



Title: Validating a cell to compare it another cell
Post by: mapner on February 10, 2018, 09:36:26 AM
Hi,

I need to edit a cell on a datagrid and validate it for value be lower that previous field/column.

thanks


Title: Re: Validating a cell to compare it another cell
Post by: jarry on February 12, 2018, 01:36:33 AM
When begin to edit a row, retrieve the editors and set the 'validType' on each field. Please refer to the code below:
Code:
$('#tt').edatagrid({
  onBeginEdit: function(index,row){
    var ed1 = $(this).datagrid('getEditor',{index:index,field:'listprice'});
    var ed2 = $(this).datagrid('getEditor',{index:index,field:'unitcost'});
    $(ed2.target).numberbox({
      validType: {
        greaterThan: [ed1.target]
      }
    })
  }
});


Title: Re: Validating a cell to compare it another cell
Post by: battlezad on February 12, 2018, 05:52:16 AM
....
never mind, it was trivial :)
...