View Full Version : myGrid.getSelectionModel().select(records) does not work.

8 Jan 2014, 2:59 PM
UPDATE2: It seems the models stored in the array passed to select() are not recognized as the same models in the store. I just don't know how that can be.

UPDATE: it seems the records are not recognized as being the same as those in the store. The data is the same, but as I have stored them in an array, perhaps when I pass that array into selectionModel.select(myArray) the records are not being found in the store, although they are there.
User makes selections in grid in window using checkboxes (plugins: [me.cellEditing]).

Next time window is launched I want previously selected rows to have their checkboxes selected, but the following does not work. Tried it without comp.getView().select() and without the boolean params to the select methods, but no change.

I do this in the grid store load handler to ensure the data has been loaded.

If I set a breakpoint, I see the selectionModel selected property has the selected item, but the UI does not reflect this.

onAfterDatastoresGridRender: function(comp) {
if(this.selectedDatastores) {
comp.getSelectionModel().select(this.selectedDatastores, true, true);
comp.getView().select(this.selectedDatastores, true, true);

10 Jan 2014, 9:06 AM
var model = this.gridView.getSelectionModel();
var recs=[];
this.store.each(function (rec) {
if (rec.get('Id') == selected[0].get('Id'))
}, this);

model.select(recs, false, true);

10 Jan 2014, 9:22 AM
I did something like that. But I thought it was a bit of a hack, because the one function call in ExtJS, I assume, should work.