1

I have a jqGrid where there is a blank row added in the end.

I need to sort the grid without considering the last blank row.

How can I achieve ? Kindly help.

enter image description here

New
  • 675
  • 1
  • 11
  • 21
suu
  • 155
  • 2
  • 9

2 Answers2

0

you can delete the last blank row before sort and then sort. here is my code please let me know if it solve your problem.

/* button Click */
$('.yourButton').click(function(){

        /* get all rows */
        var row =  $('#jqxgrid').actGrid('getrows');

        /* get the last row */
        var datarow = $("#jqxgrid").actGrid('getrowdata', row.length-1);
        if(datarow.Id){ /* check weather last row is blank or not */
            /* if blank then delete */
            $('#jqxgrid').actGrid('deleterow', row.length-1);
        }    
        /* sort the gris */
        $("#jqxgrid").actGrid('sortby', 'FieldName', 'desc');

});
Well Wisher
  • 1,825
  • 1
  • 15
  • 20
0

give some id to blank row say -1. On LoadComplete function check for blank row id is present or not before adding.