Hello,
I'm stuck in a scenario in the datagrid. There are two scenarios:
1) When I click on the header checkbox, all the records get selected on the page. But when I submit the form, I get no values from the grid since it has not pushed any values into the array.
2) But in the current page, if I independently choose all the checkboxes on the grid one by one, without selecting the header checkbox, then the select all checkbox in the header also get's checked automatically. And when I submit, I get the values due to the onCheck function written during the datagrid initialization.
Code snippet is as follows:
var checkedRows = [];
function onCheck(index,row)
{
for(var i=0; i<checkedRows.length; i++)
{
if (checkedRows[i].chkBoxVal == row.chkBoxVal)
{
return;
}
}
checkedRows.push(row);
}
function onUncheck(index,row)
{
for(var i=0; i<checkedRows.length; i++)
{
if (checkedRows[i].chkBoxVal == row.chkBoxVal)
{
checkedRows.splice(i,1);
return;
}
}
}
$('#PICKLIST_TABLE').datagrid({
url: ajax_url,
idField:'chkboxVal',
pagination: true,
pagePosition: 'both',
multiSort:true,
rownumbers:true,
striped:true,
selectOnCheck: false,
checkOnSelect: false,
onCheck:onCheck,
onUncheck:onUncheck,
fitColumns: true
});
Is it possible to attach some event/method to the header checkbox of the datagrid, so that I can get all the rows checked in the current page?

?
Also is it possible to add the elements in the array whenever the select all check box is ticked. Also if a pagination event occurs to another page, the elements should be added in the array automatically on pagination as well in case of select all checkbox being ticked?

?
Regards,
Darrel.