We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37286
    • 160 Posts
    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. [ed. note: insomnix last edited this post 13 years, 5 months ago.]
      • 14951
      • 151 Posts
      Good call @insomnix!

      That definitely seems to work a lot better. It appears I'm finally passing the correct record each time now (although I haven't done extensive testing).

      EDIT:For me there still seems to be an issue with pagination. Are you still having trouble with that as well?
      I spoke to soon... I had some other testing data in my code that was overriding it. I think that all might actually be working now!

      I keep going back and forth between going crazy and needing to finish this to just loading the grid on a new page instead of a window. It isn't ideal but at least everything seems to work.

      I sure would like to figure this all out though as this has been plaguing me (and apparently a few others) for a long time.

      Each time I make some progress I'll post back to keep things updated. Maybe if we are lucky we'll get one of the ExtJs geniuses to offer some wisdom. (a.k.a. Splittingred or Mark Hamstra) [ed. note: jaredloman last edited this post 13 years, 5 months ago.]
        • 14951
        • 151 Posts
        One other nice little tip (mainly geared towards script kiddies like me) is that you can utilize the pageSize parameter you define on the grid to set the limit by doing this:
        optionsgrid.store.baseParams = {action: 'mgr/options/values/getlist',optId: this.menu.record.id || 0 ,start: 0 ,limit: optionsgrid.config.pageSize};


        Since we are using Ext.getCmp() to grab the grid we have all of the parameters set on the grid available.

        This is probably pretty elementary to most, but hopefully will help anyone else like me.