mardi 26 juillet 2016

How to stop the onSelectAll event in a jqgrid?

I need to know if there is a checkbox selected in a jqgrid before the user clicks the "select all" checkbox. I've checked it on the onSelectAll event, but in that point all the checkboxes are already selected :( so that information is missed.

onSelectAll: function(aRowids, status) {       
     $("input[id^='jqg_'].cbox:checked").each(function() {
        //All are selecteds now :( 
        console.log("no success!");
});

I know that I could control the selected checkboxes through a javascript array and putting the ids in every 'onSelectRow' event, but I'm trying to avoid this workaround.

I've tried to bind the click event in the 'Select all' checkbox, but the 'onSelectAll' event is fired before the 'click' event :(

     $("#cb_list1").bind({
        click: function() {
        console.log("hello");},
     });

So 'hello' appears after 'no success', and the 'no success' appears as many rows my jqgrid has (no matter how many were already selected before clicking the 'select all' checkbox).

Any idea?

Thank you!




Aucun commentaire:

Enregistrer un commentaire