Opened 16 years ago
Closed 15 years ago
#2250 closed defect (fixed)
getSelectedData fails in single select mode when there is no selection
Reported by: | Owned by: | Tom Trenka | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | General | Version: | 0.4.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I added the highlighted part of the below method to handle the case where the table is in single select mode and there was no selection. It was trying to access the 0 index item of an empty array before this change.
- Michael Latta
getSelectedData: function(){ // summary // returns all objects that are selected. var data=this.store.get(); var a=[]; for(var i=0; i<data.length; i++){ if(data[i].isSelected){ a.push(data[i].src); } } // ******************************************************************************* // the following 3 lines are required to deal with single select mode and an empty selection if(a.length == 0) { return null; // no current selection } else // ******************************************************************************* if(this.multiple){ return a; // array } else { return a[0]; // object } },
Change History (2)
comment:1 Changed 15 years ago by
Owner: | changed from anonymous to Tom Trenka |
---|
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
(In [7026]) Fixes #2250.