PDA

View Full Version : Exz 3.1.1 - How to load a stores record definition dynamically



quen567
14 Oct 2010, 6:56 AM
Hi everyone
I need an Idea on how to load a record definition dynamically.

I have a Grid where the headers are already loading dynamically. Now I need the Store to match the loaded headers.

This is how a Store in my application normally looks like:


myStore = Ext.extend(BasicStore,{
url:'./controller/action',
recordDef: Ext.data.Record.create([
{name:'day'},
]),

});I need the recordDef in the Store to be loaded dynamically.
I already tried it. But the Store won't change when setting it again in the callback of the request.


myGrid = Ext.extend(Ext.grid.GridPanel, {

loadMask:true,
stripeRows: true,

initComponent : function() {

var self = this;
var callback = function(success, result){
self.store = myStore(result.data.myNewRecordDef);
}
rpc.sendRequest('./controller/action', {}, callback);

Ext.apply(this, {
sortable: true,
columns: [my columns],
viewConfig: {
forceFit: true
}
});

this.store = new myStore();

myGrid.superclass.initComponent.call(this);
}
});Has anyone an Idea on how to achiev this?