Hello,
Newbie here and can't seem to get a handle on inter-object method invocation. What I'd like to do is get a view's store object from a function in my controller. I step through in the debugger, and everything looks fine until I get to the line in red in the code below (var store = grid.getStore()) at which point I get:
Uncaught TypeError: Object function constructor() { // Opera has some problems returning from a constructor when Dragonfly isn't running. The || null seems to // be sufficient to stop it misbehaving. Known to be required against 10.53, 11.51 and 11.61. return this.constructor.apply(this, arguments) || null; } has no method 'getStore'
I can even see the grid variable in the Chrome debugger, and two superclasses up I can see the getStore function is there. What dumb thing am I doing here?
Here's the code:
Store Definition:
Code:
Ext.define('MyApp.store.conditions.Conditions',{
extend : 'Ext.data.Store',
alias : 'store.conditions',
model : 'MyApp.model.conditions.Condition',
proxy : {
type : 'ajax',
...
View Code:
Code:
Ext.define('MyApp.view.conditions.ConditionsGrid',{
extend : 'Ext.grid.Panel',
alias : 'widget.conditions.grid',
requires : [
'Ext.view.TableChunker',
'Ext.selection.RowModel',
'Ext.grid.column.Column'
],
border : false,
initComponent : function(){
var me = this;
me.store = Ext.create('MyApp.store.conditions.Conditions')
me.columns = me.buildColumns();
me.callParent();
me.store.load();
},
...
Controller Code:
Code:
Ext.define('MyApp.controller.triggers.Triggers',{ //Create the controller that is loaded when the user clicks on one of the options on the main menu (see controller/Main.js)...
extend : 'Ext.app.Controller',
models : [ //...and then include any needed models to be used by included stores...
'triggers.Trigger',
'conditions.Condition'
],
stores : [ //...and then include any needed stores to be used by included views...
'triggers.Triggers',
'conditions.Conditions'
],
views : [//...and then include any needed views to be used by this controller...
'triggers.TriggerForm',
'conditions.ConditionsGrid',
'triggers.TriggersGrid',
'triggers.MainContainer'
],
init : function(){
var me = this;
me.control({
'#maintabs #triggermain grid' : { //Define double click action for grid items
itemdblclick : me.loadConditionsGrid
}
});
},
loadConditionsGrid : function(grid,record,item,index,event,options){
var grid = this.getConditionsConditionsGridView();
var store = grid.getStore();
grid.getStore().getProxy().setURL('http://localhost:8080/OHMA-Config/trigger/getConditionWithName/?name=cruise');
},
addContent : function(){
this.container.add({ //Get the main tab and to it add the user defined Triggers MainContainter view (app/view/triggers/MainContainer.js).
xtype : 'triggers.main',
itemId: 'triggermain'
});
}
});