PDA

View Full Version : Checkbox Selection Model cannot check a row using a newly created record



Mandeep
10 Oct 2012, 10:28 AM
I am having difficulty checking a row manually in a grid which is using Ext.selection.Model. I am trying to use select function and it works if I pass index of the record that I need to check, it even works if I do something like select(store.getAt(index)) but if I try to create a record myself as following
var record = Ext.create('User', {ID: '10', MyID: '10', Name:'David'});
then it doesn't work, I am sure that there is a record with id 10.
My model is as follows
Ext.define('User', {
//extend: 'Ext.selection.Model',
extend: 'Ext.data.Model',
idProperty: 'MyID',
fields: [
{name: 'MyID', type: 'string'},
{name: 'ID', type: 'string',
{name: 'Name', type: 'string'}
]
});

The collection named 'selected' which stores the checked records in the selection model does gets updated and has the newly created record in it.

Any help will be much appreciated.
Thanks.

mitchellsimoens
15 Oct 2012, 7:45 AM
Do you insert var record = Ext.create('User', {ID: '10', MyID: '10', Name:'David'}); into the store?