jQWidgets Forums
jQuery UI Widgets › Forums › Grid › getselectedrowindexes => index returned even unselected
Tagged: grid selection
This topic contains 10 replies, has 7 voices, and was last updated by svetoslav_borislavov 2 years, 2 months ago.
-
Author
-
Hi Peter,
I set the grid’s selectionmode to ‘multiplerowsextended’.
When i selected multiple rows (says 5 rows) and then purposely unselect certain row (says first of the 5 selected rows), the following function still returns array of 5 selected rows (including the one already unselected in the grid).
var selectedrowindexes = $(‘#jqxgrid’).jqxGrid(‘getselectedrowindexes’);
Can you help?
Thanks.regards,
DVHi DV,
From the provided information, I don’t know when you call the function. If you would like us to test your scenario, please, provide a sample which demonstrates it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Let me try to illustrate:
1) I initialize the grid’s selectionmode to ‘multiplerowsextended’.
2) Say i load the grid with 10 rows of data
3) I select 5 rows of the grid , from index/row 2 to 6 (by holding shift key) ; total rows selected = 5
4) then i unselect index/row 2 (by clicking on row 2 while holding the Ctrl key) ; total rows selected should be = 4 now.
5) while the 4 rows are still selected, i click a button that trigger a function that calls getselectedrowindexes
$(‘#combineButton’).click(function () {
var selectedrowindexes = $(‘#jqxgrid’).jqxGrid(‘getselectedrowindexes’);
var selectedcount = selectedrowindexes.length;
if (selectedcount > 0){
var rowData = $(“#jqxgrid”).jqxGrid(‘getrowdata’, selectedrowindexes[0]);
var str_idx = $(“#jqxgrid”).jqxGrid(‘getrowid’, selectedrowindexes[0]);
var count = selectedrowindexes.length;
for (var i = 1; i < selectedcount; i++){
str_idx = str_idx + "," + $("#jqxgrid").jqxGrid('getrowid', selectedrowindexes[i]);
console.log(selectedrowindexes[i]);
}
console.log(str_idx);
}
});6) the result shows index of 5 rows of index (instead of 4), that are 2,3,4,5,6
7) when i repeat step 4 on index/row 3, (total rows selected now = 3 ) , the function still returns 5 rows of index (instead of 3)
Hope this is clearer.
Thanks.regards,
DVThank you for the provided information. We’ll test using the provided code and in case we reproduce the reported behavior, we will create a work item about it and will resolve it for a future version.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi DV,
We confirm the reported behavior and we will resolve it for the upcoming release.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Is this bug Fixed? I updated yesterday to the last version and the behavior is the same.
Thank you
Ricardo
Same thing here. Just ran into the same bug.
It seems to relate to filters present.
If you have a row selected, then filter in such way that row is no longer visable, it still shows up in selectedrowindexes and trying to get it returns error or nonsense….
I guess filtering should disselect everything…
Bart
There’s absolutely no issue with rows selection in the current version. This topic is from 2012. The Grid’s selection is changed, methods are different, behavior is different. So guys, if you want to report issues, then create new topics which are about the current version, provide jsfiddle.net sample which demonstrates an issue and if we reproduce the issue and confirm it, then we will fix it in a future release. About the last post – it does not matter whether the row is visible or not. If it was selected, the selectedrowindexes will contain the row’s bound index.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comfor firs time grid is load with data with enable checkbox boxs . then select the rows using
var rows = $(“#main_grid3”).jqxGrid(‘selectedrowindexes’); on
on this event.
$(‘#main_grid3’).on(‘rowselect’, function (event) {
var args = event.args;
var row = args.rowindex;
var rowdata = args.row;var data = $(‘#main_grid3’).jqxGrid(‘getrowdata’, rowdata);
totalAmountSelected = “”;var rows = $(“#main_grid3”).jqxGrid(‘selectedrowindexes’);
var selectedRecords = new Array();
for (var m = 0; m < rows.length; m++) {
var row = $(“#main_grid3”).jqxGrid(‘getrowdata’, rows[m]);
selectedRecords[selectedRecords.length] = row;
totalAmountSelected = totalAmountSelected + row.Record_Id + “|”;
}now the array is 1000 size.
now reload gird with new data with selected checkboxs ,
var rows = $(“#main_grid3”).jqxGrid(‘selectedrowindexes’); this will show old selected values. array size with 1000 size.can any one resolve the solution . how can i get newly selected records from the grid.
I have the same problem
10 years later in 2023Hi,
Can you provide a sample in jsfiddle, so we can identify the problem, please?
We are waiting for you!Best regards,
Svetoslav BorislavovjQWidgets Team
https://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.