jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Real KO object index when filtering data???
Tagged: index; KO; Grid
This topic contains 2 replies, has 2 voices, and was last updated by Sacrifice 12 years, 3 months ago.
-
Author
-
Hi jqwidgets team, I’ve some problem with a KO jqxGrid when I’m filtering value.
here it’s my function
$("#deleterowbutton").on('click', function () { var selectedrowindex = $("#jqxgrid").jqxGrid('getselectedrowindexes'); var rowscount = $("#jqxgrid").jqxGrid('getdatainformation').rowscount; selectedrowindex.sort(function(a,b){return b-a}); if (selectedrowindex != -1) { for(i=0;i<selectedrowindex.length;i++) { var rowid = $('#jqxgrid').jqxGrid('getrowid', selectedrowindex[i]); model.items.remove(model.items()[rowid]); console.log("index = " + selectedrowindex[i] + " ID = " + rowid + " rowscount = " + rowscount); //used for debug } } $("#jqxgrid").jqxGrid('clearselection'); $(columnCheckBox).jqxCheckBox('uncheck'); });
that work I’m got corrected index form grid but when I’m filtering data, all index gone wrong??
Grid was reorder row index to 0 and reorder all shown row, that why I can’t remove correct data
form KO model.
example
index data
0 AS
1 BD
2 SF
3 GD
4 ZXWhen I’m filtering D on data index from grid will changed like this
index data
0 BD
1 GDhow I can get BD index = 1 and GD index = 3 ?????
Hi Sacrifice,
To delete a row from jqxGrid, use the “deleterow” method. In addition, you can pass an array of row ids to the function instead of calling the function multiple times in a loop. In addition, when you define a loop I suggest you to use for(var i…. not for(i…
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter Stoev,
Thank you for advice, when I’m used a ‘deleterow’ that not made KO model change the data
here it’s my code
var rowid = $('#jqxgrid').jqxGrid('getrowid', selectedrowindex[i]);var commit = $("#jqxgrid").jqxGrid('deleterow', rowid);
have another solution for delete a real KO data with jqxgrid filtering form??
-
AuthorPosts
You must be logged in to reply to this topic.