Wednesday, 21 August 2013

pass extraParams within the MVC tree store as load parameters

pass extraParams within the MVC tree store as load parameters

Suppose I have the following Sencha MVC tree store below. I'd like to pass
two parameters, defined in "extraParams" to the load, but I need to get a
reference to "this" in order to get the current values of the record
clicked. Before I started working with MVC, I used to pass them in the
autoLoad config, but the problem this time is that I need a reference to
this. Can I still do it that way, or should it be done a different way. I
tried the "beforeload" event, and that did not work.
Ext.define('MyApp.store.Test', {
extend: 'Ext.data.TreeStore',
xtype: 'store-test',
model : 'MyApp.model.Test',
nodeParam: 'node',
root: {
text: 'root',
id: '0',
expanded: true
},
proxy: {
type: 'direct',
directFn: CRUD.read,
reader: {
root: 'data'
},
extraParams: {
delimited_id: '0',
formatted_id: '0'
}
},
autoLoad: false,
listeners: {
// load: function( this, node, records, successful, eOpts ) {
// },
beforeload: function(store, operation, options) {
// not working ?
//operation.params.delimited_id =
operation.node.get('delimited_id');
//operation.params.formatted_id = operation.node.get('node_id');
// not working ?
//this.proxy.extraParams.delimited_id =
operation.node.get('delimited_id');
//this.proxy.extraParams.node_id = operation.node.get('node_id');
}
} // listeners
});

No comments:

Post a Comment