ragecf
17 Jul 2013, 12:15 AM
Hi everybody,
I want to pass a variable to extraParams of store. But It doesn't work.
Ext.define('myModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'auto'},
{name: 'value', type: 'auto'}
]
});
Ext.define('myStore, {
extend: 'Ext.data.Store',
model: 'myModel,
autoLoad: false,
proxy: {
type: 'ajax',
url: 'xxx.php',
reader: {
type: 'json',
root: 'root'
},
sortParam: null,
pageParam: null,
startParam: null,
limitParam: null,
extraParams: {
param: this.myParam
}
}
});
Ext.define('myGrid', {extend: 'Ext.grid.Panel',
initComponent: function() {
this.store = Ext.create('myStore', {
myParam: 'something according to different condition'
});
this.columns = [......];
Ext.apply(this, {
title: 'My Grid'
});
this.callParent(arguments);
});
}
});
var grid = Ext.create('myGrid');
grid.renderTo(document.body);
I want to pass a variable to extraParams of store. But It doesn't work.
Ext.define('myModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'auto'},
{name: 'value', type: 'auto'}
]
});
Ext.define('myStore, {
extend: 'Ext.data.Store',
model: 'myModel,
autoLoad: false,
proxy: {
type: 'ajax',
url: 'xxx.php',
reader: {
type: 'json',
root: 'root'
},
sortParam: null,
pageParam: null,
startParam: null,
limitParam: null,
extraParams: {
param: this.myParam
}
}
});
Ext.define('myGrid', {extend: 'Ext.grid.Panel',
initComponent: function() {
this.store = Ext.create('myStore', {
myParam: 'something according to different condition'
});
this.columns = [......];
Ext.apply(this, {
title: 'My Grid'
});
this.callParent(arguments);
});
}
});
var grid = Ext.create('myGrid');
grid.renderTo(document.body);