Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJS-18860
in
6.0.2.437.
-
Sencha Premium Member
Spreadsheet selection model getSelection doesn't return selected records
Hello.
In this fiddle I log output of getSelection and getSelected method on spreadsheet model. Addocring to the getSelecton doc, I'd expect it to return records for selected cells, but result is empty list.
steps to reproduce:
1) select single cell, click on button -> selection is []
2) select row by clicking on leftmost column -> selection is correct
-
Sencha - Support Team
Thanks for the report, I've opened a ticket in our bug tracking system.
Regards,
Bryan
-
Sencha User
Why is this entry marked as fixed? I am having the same problem with version 6.0.2.437 and even with 6.2.0. If you start ragzovskii's fiddle and switch to 6.0.2.437, getSelection still returns an empty array for me. According to the API reference it should work...?
-
Sencha Premium User
I checked this in the latest version 6.2.1 and this is still broken. I keep encountering numerous posts Sencha marked as "Fixed" but when I check the "Fiddle" it is not working. I wonder if there is some other factor. I am running Chrome 54.0.2840.87 m (64-bit)
-
Sencha - Support Team
This issue is not a bug and not fixed by or related to EXTJS-18860.
The getSelection method only returns selected rows.
Code:
getSelection: function() {
// API docs are inherited.
// Superclass returns array of selected records
var selData = this.selected;
if (selData && selData.isRows) {
return selData.getRecords();
}
return [];
}
For selected cells use the spreadsheet selection model getSelected method.
You can then use the grid selection eachCell method to iterate over the selected cells.
The first parameter is the context object which contains the record (context.record).
Code:
handler: function() {
var selected = panel.getSelectionModel().getSelected()
selected.eachCell(function(context, column, row) {
console.log(context.record)
});
}
Fiddle example:
https://fiddle.sencha.com/#fiddle/1s5t&view/editor
-

Originally Posted by
fmoseley
For selected cells
sue the spreadsheet selection model
getSelected method.
I'm pretty sure the typo should be use instead.
-
Sencha User
thank you I have the same problem in my work