PDA

View Full Version : YAHOO.ext.grid.DefaultSelectionModel.selectRowsById bug



kovtik
1 Nov 2006, 1:18 PM
Look at the following code from SelectionModel.js:
YAHOO.ext.grid.DefaultSelectionModel.prototype = {
//...
/**
* Set the selected rows by their ID(s). IDs must match what is returned by the DataModel getRowId(index).
* @param {String/Array} id The id(s) to select
* @param {Boolean} keepExisting (optional) True to retain existing selections
*/
selectRowsById : function(id, keepExisting){
var rows = this.grid.getRowsById(id);
this.selectRows(rows, keepExisting);
},
//...
};
Should be

selectRowsById : function(id, keepExisting){
var rows = this.grid.getRowsById(id);
if (!(rows instanceof Array)){
this.selectRow(rows, keepExisting);
return;
}
this.selectRows(rows, keepExisting);
},

jack.slocum
1 Nov 2006, 9:37 PM
Thanks. grid.getRowsById used to always return an array. That was changed at one point and this function must have fell behind. Thanks for providing a fix as well.

Jack