#6853 closed defect (fixed)
The removeSelectedRows method seems to be broken
Reported by: | guest | Owned by: | Bryan Forbes |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | DojoX Grid | Version: | 1.1.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
This method of _grid.js seems to be broken and do not do what is expected. The last item in store is removed from grid insted of selection.
removeSelectedRows: function(){ // summary: // Remove the selected rows from the grid. this.updateRowCount(Math.max(0, this.rowCount - this.selection.getSelected().length)); this.selection.clear(); }
Compare insted the code in Nightly Build 28/05/2008
removeSelectedRows: function(){ this.edit.apply(); var s = this.selection.getSelected(); if(s.length){ this.model.remove(s); this.selection.clear(); } },
The items are not removed from store
thanks
Eduardo
Attachments (1)
Change History (9)
Changed 13 years ago by
Attachment: | test_data_grid_empty.html added |
---|
comment:1 Changed 13 years ago by
Replication instructions.
[1] Add four, five nodes. [2] Select any item except last. [2] Choose remove selected button
Result: Last will be deleted insted item you chose.
Note: In my real application I saw sometimes, a slight different behavior if several alternatively nodes are chosen (example item1,item3, item5 tigether in one selection) . I think that probably there is an additional bug there, but I cannot be sure of that.
thanks !!
Eduardo
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Hi Bryan
I reopen this PR, because something is not working. May be the problem is not in the dataGrid. My program falls inside the removeSelected when you call the dojo.forEach(items, this.store.deleteItem) line.
I have two grids: gridAssigned and gridUsers when and I transfers selected rows from gridAssigned to gridUsers. In gridUsers I recreate a equivalent line and in gridAssigned I remove each line.
See please the code above , the first work, the second falls, I used a code very similar to your removeSelected.
var selRows = new Array(); selRows=gridAssigned.selection.getSelected(); noassigned=selRows.length; if(noassigned < 1){ return; } for(i=0;i<noassigned;i++){ name = selRows[i].unam; grid = selRows[i].grid; id ="\'"+selRows[i].id+"\'"; modelUsers.newItem({id:id,unam:name,grid:grid}); } /*gridAssigned.removeSelectedRows();** gridAssigned.edit.apply(); for (i=0;i<noassigned;i++){ gridAssigned.store.deleteItem(selRows[i]); } noassigned=0; gridAssigned.selection.clear(); gridAssigned.render(); gridUsers.setSortIndex(0,true);
var selRows = new Array(); selRows=gridAssigned.selection.getSelected(); noassigned=selRows.length; if(noassigned < 1){ return; } for(i=0;i<noassigned;i++){ name = selRows[i].unam; grid = selRows[i].grid; id ="\'"+selRows[i].id+"\'"; modelUsers.newItem({id:id,unam:name,grid:grid}); } gridAssigned.edit.apply(); gridAssigned.removeSelectedRows(); <---- Falls here noassigned=0; gridAssigned.selection.clear(); gridAssigned.render(); gridUsers.setSortIndex(0,true);
The error message I received in my FF2 error console is:
this._assert is not a function Line 219 in dojo.js
comment:5 Changed 13 years ago by
Owner: | changed from sorvell to Bryan Forbes |
---|---|
Status: | reopened → new |
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 Changed 13 years ago by
Milestone: | → 1.2 |
---|
marking tickets closed in the last three months w/blank milestone to milestone 1.2.
See replication instructions, please