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.
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.
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');
});
give some id to blank row say -1. On LoadComplete function check for blank row id is present or not before adding.