jQuery UI Widgets Forums Grid What can prevent grid rows from being deleted?

This topic contains 2 replies, has 2 voices, and was last updated by  andy8 10 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • andy8
    Participant

    Hello All,

    This is a simple code that works fine for several grids, but doesn’t delete any rows from one “stubborn” grid:

    	  var rowindexes = $(gridDiv).jqxGrid('getselectedrowindexes');
    for (var i = rowindexes.length -1; i >=0; i--) {
    $(gridDiv).jqxGrid('deleterow', rowindexes[i]);
    }
    $(gridDiv).jqxGrid('clearselection');

    I have been debugging it line-by-line…. the array of row ids is OK, no errors thrown, but it doesn’t delete rows. The last line of code clears selected rows.

    the grid selection mode:

    selectionmode: 'checkbox',

    The grid is editable… What could prevent the grid from deleting the rows?

    thanks

    • This topic was modified 10 years, 4 months ago by  andy8.

    Dimitar
    Participant

    Hello andy8,

    The deleterow method requires row id as a parameter and not row index. Here is how you should modify your code for the method to work correctly:

    var rowindexes = $(gridDiv).jqxGrid('getselectedrowindexes');
    for (var i = rowindexes.length - 1; i >= 0; i--) {
    var id = $(gridDiv).jqxGrid('getrowid', rowindexes[i]);
    $(gridDiv).jqxGrid('deleterow', id);
    }
    $(gridDiv).jqxGrid('clearselection');

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    andy8
    Participant

    Thanks Dimitar! It works!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.