PDA

View Full Version : Ext.each() to retrive the selected values from the grid



punith.mailme
15 Mar 2012, 2:31 AM
Hi All,

I have a grid and i want to get the selected values to be retrived. I am doing it as below but getting a error

Uncaught TypeError: Cannot read property 'internalId' of undefined

Ext.define.updateIndexesext-all-debug.js:60517 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.onAddext-all-debug.js:60470 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Base.callParentext-all-debug.js:2891 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.onAddext-all-debug.js:78868 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
fireext-all-debug.js:10658 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.continueFireEventext-all-debug.js:13854 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.fireEventext-all-debug.js:13834 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.insertext-all-debug.js:45162 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.addext-all-debug.js:45187 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
(anonymous function)Search.js:107 (http://www.sencha.com/forum/chrome-devtools://devtools/Search.js)
Ext.Array.eachext-all-debug.js:953 (http://localhost:7001/vl_web/extjs/ext-all-debug.js)
Ext.define.addTrims

Ext.each(Ext.getCmp('availableBodyTrimPanel').getSelectionModel().getSelection(), function(record, index, allRecords) {
me.getSelectedTrimsStore().add(record);
});



kindly help pls............

thanks
Punith

tvanzoelen
15 Mar 2012, 4:04 AM
What kind of store and model has availableBodyTrimPanel? Is it different from me.getSelectedTrimsStore()?

In that case maybe the two different stores have different ids and is it searching for a key property that doesn't exist when you add that record.

punith.mailme
15 Mar 2012, 4:56 AM
yep u guessed it right :)

i have a same model for both of the stores.

Ext.define('com.gm.vl.model.YMMModel', {
extend: 'Ext.data.Model',
fields: ['label','value']
});

and availableBodyTrimPanel is of type selType: 'checkboxmodel', and Ext.data.Store

and SelectedTrimsStore is of simple store and xtype : grid (Not checkboxmodel)
extend: 'Ext.data.Store',
model: 'com.gm.vl.model.YMMModel',


is there any mistake as i am moving from checkbox model to simple grid ??


Thanks
Punith

punith.mailme
15 Mar 2012, 4:59 AM
and here is the recent change i did in past 10min. of overcoming using the ext.each() as i will not be doing a multiple select and handle based on each checkbox click event.

,'searchPanel grid[action=addtrimsSelect]': {
select: function(model, record, index) {
alert("select");
alert(record);
this.getSelectedTrimsStore().add(record);
this.getSelectedTrimsStore().getView().refresh();
},
//deselect: this.removeTrims
deselect: function(model, record, index) {
alert("deselect");
alert(record);
this.getSelectedTrimsStore().remove(record);

}
}



Now i have no error as above but the data is not moved(added) to other store (saw in the dev tools of chrome) and the store not refreshed :O

Please help :)