Reputation:
I have this code to select a row:
me.rows = me.getGestionRrhh().down('#pestanaDatosVariables').getSelectionModel().select(5);
it works fine, it selects the row I want but I need to make some changes, Is there any way to select a row based on a code belonged to the row selected ? I mean, if I have saved some rows which has code and name and I want to select just the rows with code 1 for example. How can I do that ?
I have tried to use the same code set it like:
var code: record.get('rowCode'),
me.rows = me.getGestionRrhh().down('#pestanaDatosVariables').getSelectionModel().select(code);
but it´s not giving me the result I need.
Upvotes: 0
Views: 75
Reputation: 429
Code : https://fiddle.sencha.com/#view/editor&fiddle/2ech
Summary :
let selected = grid.getSelection()[0];
if(!selected){
alert("select a row !");
return;
}
let codeValue = selected.get('code');
let store = grid.getStore();
//@ Ext.util.Collection
let collection = store.query("code", codeValue);
grid.getSelectionModel().select(collection.items);
Upvotes: 0