I have a UltraGrid with checkbox. I need to select multiple rows. Its working when I'm select the row manually.
but when I'm setting focus to the row by code behind, the Shift key selection is not working.
Here I have attached sample,
after reloading the data, I need to set the focus to the row which is last selected. so I am navigating to the grid by
grid.Rows[_currentRowIndex].Activate();
grid.Rows[_currentRowIndex].Selected = true;
after this line, when I'm press shift key to select, its not selecting multiple rows. its selecting the single row.
Eg : when I'm in the 6th row, after reloading the data, the focus should be in the 6th row. So I'm navigating to the 6th row by above 2 lines. after that when I'm selecting other row with shift key, it should select multiple rows. But its not happening.InfraSample.zip
Hello P Siva,
I have been investigating into the behavior you are seeing in this case, and the reason you are seeing this issue is because the Shift+Click selection behavior comes from a “pivot item” element that we track, essentially by the last row you have clicked. When you reset the data source, this is reset as well, which is why when you try to Shift+Click Row 13 from Row 6, only Row 13 is selected.
Something you can do to prevent this is to utilize the UltraGrid.ActiveRowScrollRegion.SetPivotItem() method and pass the Row that you want to be the “pivot item” as a parameter when you reset the selection. For example, using your code example above:
var row = grid.Rows[_currentRowIndex];
row.Activate(); row.Selected = true;
RowScrollRegion region = this.grid.ActiveRowScrollRegion; region.SetPivotItem(row);
Please let me know if you have any other questions or concerns on this matter.
Any update on the above query?
Yes , my expectation is to select from row6 to row13.
Consider when i'm in row6, and click to reload data. like i mentioned in first post, after reloading the data i setting the focus to row6 by
with the above lines, focus setting to row6. now when i'm selcting shift + mouse click to row13.
im expectng to select, row6 to row13 . but its not happening.
don't consider tick field, here i'm talking about multiple row selection.
Hello,
Your video is not clear of what you are expecting. You click reload button and then clicked row13 but checkbox of row13 dint get selected. Is this your issue or you are expecting to get rows from row6 to row13 get select?
For me when i click any row after i click reload button its get selected as in the video, which is expected. Rows from row6 to row 13 will not select since you are clicking reload button datasopurce will change..
The grid doesn't retain it's selection upon a data source change. Perhaps there may be an alternative to resetting the Datasource for you. Or you'll have to store a list of all indices (you are doing this already for index 0eg. grid.Rows[_currentRowIndex].Selected = true;
Let me know if you have any questions.
Hi I focused on row3 and click reload button after that press shift + mouse click on row13 its not happening for multiple selection. Here I attached the video for your reference and I am using version V21.2SampleVideo.zip