Thanks, @jaredloman. Using the code you provided I took another look at the code and did some more testing and I think I found a solution.
Doodle.grid.DoodleList = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'doodle-grid-doodlelist'
,url: Doodle.config.connectorUrl
,baseParams: {
action: 'mgr/doodle/getlist'
}
,fields: ['id','DoodleName','menu']
,paging: true
,remoteSort: true
,anchor: '97%'
,autoExpandColumn: 'DoodleName'
,columns: [{
header: 'Doodle Name'
,dataIndex: 'DoodleName'
,sortable: true
,width: 30
}]
,getMenu: function() {
return [{
text: 'Doodle Options'
,handler: this.viewOptions
}];
}
,viewOptions: function(btn,e) {
if (!this.updateDoodleListWindow) {
this.updateDoodleListWindow = MODx.load({
xtype: 'doodle-window-doodlelist'
,record: this.menu.record
,doodle_id: this.menu.record.id // pass the doodle id on to the window so it can be passed to the grid for the first time it opens
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
}
this.updateDoodleListWindow.setValues(this.menu.record);
this.updateDoodleListWindow.show(e.target);
var optionsgrid = Ext.getCmp('doodle-grid-doodleoptions');
// must define action here, otherwise the baseParams will remove it and cause the grid to never load
optionsgrid.store.baseParams = {action: 'mgr/doodles/getoptionlist',doodle_id: this.menu.record.id || 0,start: 0 ,limit: 20};
// still have to load the grid
optionsgrid.store.load();
// optionsgrid.store.load({params:{doodle_id: this.menu.record.id || 0}}); removed this line
}
});
Doodle.grid.DoodleList.superclass.constructor.call(this,config)
};
Ext.extend(Doodle.grid.DoodleList,MODx.grid.Grid);
Ext.reg('doodle-grid-doodlelist',Doodle.grid.DoodleList);
Doodle.window.UpdateDoodle = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('doodle.update')
,url: Doodle.config.connectorUrl
,baseParams: {
action: 'mgr/doodle/update'
}
,autoHeight: false
,height: Ext.getBody().getViewSize().height*.85
,autoScroll: true
,fields: [{
xtype: 'hidden'
,name: 'id'
},{
xtype: 'textfield'
,fieldLabel: 'Doodle Name'
,name: 'DoodleName'
,anchor: '100%'
},{
xtype: 'doodle-grid-doodleoptions'
,fieldLabel: 'Doodle Options'
,doodle_id: config.doodle_id // pass the id needed for the initial window render
}]
});
Doodle.window.UpdateDoodleList.superclass.constructor.call(this,config);
};
Ext.extend(Doodle.window.UpdateDoodle,MODx.Window);
Ext.reg('doodle-window-doodlelist',Doodle.window.UpdateDoodle);
Doodle.grid.DoodleOptions = function(config) {
config = config || {};
Ext.applyIf(config,{
id: 'doodle-grid-doodleoptions'
,url: Doodle.config.connectorUrl
,baseParams: {
// still need the action here, otherwise the error log will fill up with annoying getlist Processor missing errors when the window opens for the first time after a page load.
action: 'mgr/doodles/getoptionlist'
,doodle_id: config.doodle_id // pass the id needed for the initial grid render
}
,viewConfig: {
forceFit: true,
enableRowBody: true
}
,fields: ['id','DoodleOption','DoodleOptionPrice']
,paging: false
,showPerPage: false
,remoteSort: true
,columns: [{
header: 'Doodle Option Name'
,dataIndex: 'DoodleOption'
,sortable: true
,width: 20
},{
header: 'Doodle Option Price'
,dataIndex: 'DoodleOptionPrice'
,sortable: true
,width: 20
}]
});
Doodle.grid.DoodleOptions.superclass.constructor.call(this,config);
};
Ext.extend(Doodle.grid.DoodleOptions,MODx.grid.Grid);
Ext.reg('doodle-grid-doodleoptions',Doodle.grid.DoodleOptions);
So far this method appears to work better than the previous.