EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: thecyberzone on February 02, 2015, 02:37:40 AM



Title: Accessing Checkbox column state in a datagrid
Post by: thecyberzone on February 02, 2015, 02:37:40 AM
I have defined a column in a editable checkbox as follows:

{field:'final',checkbox:true},

Now to set the initial checkbox value I have used a loop as follows:

var rows = $(this).datagrid('getRows');
for(var i=0; i<rows.length; i++){
    if(rows['final'] == 'Y') {
   $(this).datagrid('checkRow',i);
    }
}

Now whenever I want to acces the checkbox value of a particular row by using row.final it always returns the initial value, not the changed value depending on checbox state checked/unchecked.

What should I use if I want to access that checkbox value/state ?


Title: Re: Accessing Checkbox column state in a datagrid
Post by: stworthy on February 02, 2015, 04:05:12 AM
Please try this:
Code:
$('#dg').datagrid({
    onCheck: function(index,row){
        row.final = true;
    },
    onUncheck: function(index,row){
        row.final = false;
    }
})


Title: Re: Accessing Checkbox column state in a datagrid
Post by: thecyberzone on February 02, 2015, 07:00:12 AM
Thanks for your reply, I have already done in the same way by assuming row.final value as 'Y' in onSelect event and row.final value as 'N' in onUnselect event.