Opened 11 years ago
Closed 9 years ago
#10438 closed defect (patchwelcome)
DataGrid large selection doesn't work
Reported by: | andre steenveld | Owned by: | Evan |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | DojoX Grid | Version: | 1.4.0b |
Keywords: | datagrid selection | Cc: | brianforbes, Nathan Toone |
Blocked By: | Blocking: |
Description
When selecting items programmaticly in a grid via grid.selection.addToSelection() only the items that are rendered will be selected.
In this supplied test case there is a dataset of about ~800 records, all items are selected when the store is attached to the grid. Yet the resulting selection is only 25 records. I am working on a patch.
Attachments (1)
Change History (9)
Changed 11 years ago by
Attachment: | RangeSelection.patch added |
---|
comment:1 follow-up: 2 Changed 11 years ago by
comment:2 Changed 11 years ago by
Replying to andre steenveld:
The patch adds a method to dojox.data.DataSelection? called selectRange( start, count ). It will force the grid to get the items in the range, index them and add them to the selection. It seems like a slightly hackish solution but it works. I will add another demo tomorrow which will demonstrate the fix.
The fix is not working in 1.4.2. I am still seeing the same problem described above with addToSelection().
function test() { var gridObj = dijit.byId(dataGrid); gridObj.selection.selectRange(0, 171); // My grid displays 23 lines and buffer/rowsPerPage holds 50. var obj = gridObj.selection.getSelected(); if (obj.constructor == Array) { alert('getSelected returned array with length ' + obj.length) ; alert(obj[0]); } else { alert('not array'); } for (i = 0; i < obj.length; i++) { if (!store1.isItem(obj[i])) { alert('NOT an item starting at index: ' + i); break; // This breaks for me (the first round) at i = 50. } if (i == 171 && store1.isItem(obj[i])) { alert('object ' + i + ' email: ' + gridObj.store.getValue(obj[i], 'Email')); } } alert('finished'); }
comment:3 Changed 11 years ago by
I have the same problem when manually selecting (using click + shift-click) all rows. I believe that only the rows that are in the cache (QueryReadStore?) are actually returned, the rest are null items.
comment:5 Changed 9 years ago by
Cc: | brianforbes Nathan Toone added; brianforbes toonetown removed |
---|---|
Milestone: | tbd → 1.7 |
Owner: | set to evan |
comment:6 Changed 9 years ago by
Owner: | changed from evan to Evan |
---|
comment:7 Changed 9 years ago by
Milestone: | 1.7 → future |
---|
comment:8 Changed 9 years ago by
Milestone: | future → 1.8 |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
It's a long known issue of grid.getSelected() which will only return items currently rendered, though actually a wide range rows are already selected.
The unexpected behavior is grid.getSelected() will trigger fetching more selected items in an asynchronous way so if we check grid.getSelected() with a timeout later, then we may get all the selected rows, but the problem is 'when' to check that.
Based on the existing logic, don't think there is any easy fix without significant changes, so closing as 'patchwelcome'
The patch adds a method to dojox.data.DataSelection? called selectRange( start, count ). It will force the grid to get the items in the range, index them and add them to the selection. It seems like a slightly hackish solution but it works. I will add another demo tomorrow which will demonstrate the fix.