We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20135
    • 188 Posts
    Hi all.

    ExtJS, or MODext, is a difficult subject with little documentation, so I'm coming here for some assistance. I have 2 issues, both within the same code.

    Basic summary, I have a single page with 2 tabs displaying info from 2 different custom tables. The 2 tabs (respectively: Clients, Budgets) are displaying well, the grids with the info are almost entirely displaying properly. Almost...

    Firstly: I have a combo that is extending MODx.combo to display the full names of users with the username as the value, and have referenced the Ext.util renderer to display the values. On the Budgets tab (2nd tab) this works fine, but on the Clients tab (1st tab) the display won't render out (the combo still displays on double-click. Here's my codes...

    Firstly the extension:
    GR8.combo.User = function(config) {
        config = config || {};
        Ext.applyIf(config,{
    	id: 'user'
            ,name: 'user'
            //,hiddenName: 'user'
            ,displayField: 'fullname'
            ,valueField: 'username'
            ,fields: ['fullname','username']
            ,pageSize: 20
            ,url: MODx.config.connectors_url+'security/user.php'
            ,typeAhead: true
            ,editable: true
        });
        GR8.combo.User.superclass.constructor.call(this,config);
    };
    Ext.extend(GR8.combo.User,MODx.combo.ComboBox);
    Ext.reg('gr8-combo-user',GR8.combo.User);
    

    Next, the combo field code for the Clients tab:
    {
       header: 'Agent'
       ,dataIndex: 'clientAgent'   //equates to modx username
       ,sortable: true
       ,width: 60
       ,editor: { xtype: 'gr8-combo-user' ,renderer: true}
       ,renderer: Ext.util.Format.comboRenderer(GR8.combo.User, 'clientAgent')
    }

    Finally, the combo field code for the Budgets tab:
    {
       header: 'Agent'
       ,dataIndex: 'budgAgent'
       ,sortable: true
       ,width: 60
       ,editor: { xtype: 'gr8-combo-user' ,renderer: true}
       ,renderer: Ext.util.Format.comboRenderer(GR8.combo.User, 'budgAgent')
    }

    Am I missing something, or is there an issue here that's not easy to see?

    Secondly: When I do make a change to the grid, the change isn't saved - the little red triangle stays in the top left corner of the field in the grid. I'm guessing I need to add a Save button somewhere, but I have no idea where to put that or what to put there. There is no documentation around this, which is sad... Maybe if I get the assistance on this I could submit something...

    Can someone help me make a Save feature please? And also work out what's going on with the combo. I'm happy to post any code necessary for y'all to see what's going on. Thanks greatly.
      • 20135
      • 188 Posts
      Has anyone got any ideas for this? Really need some assistance...
        • 20135
        • 188 Posts
        Starting to find some solutions (thanks to @MODX on Twitter for retweeting my cries for help!): http://stackoverflow.com/questions/24566336/extjs-modx-cmp-grid-edits-not-saving-to-db-combo-box-not-displaying/24652394?iemail=1&noredirect=1#24652394