We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38865
    • 10 Posts
    Hi there,
    I'm on my first attempt at customizing the manager. Based on other posts I've figured out how to add another Tab to the User Manager Pages. On this page I have a Modx.combo. Everything works great, I can save the selected values, figured out a hack to preselect the value (OnUserFormRender I write the value to a js variable that I then use in my usertabs.add function). The problem I'm pulling my hair out with is that if an admin edits a user and the only thing they do is select an initial or different value in the combo the save button is still disabled. The only way I can enable it is to go and edit a field and then change it back again.

    Ext.onReady(function () {
    
        var usertabs = Ext.getCmp('modx-user-tabs');
        usertabs.add({
            title: 'Phybridge Portal',
            defaults: { labelWidth: 180 },
            layout: 'form',
            autoScroll: true,
            autoHeight: false,
            labelAlign: "left",
            labelWidth: 180,
            width: 800,
            height: 500,
            cls: 'main-wrapper',
            items: [
                {
                html: '<p style="margin-bottom:10px;">Select which Phybridge staff member is to be this person\'s assigned Sales Manager.</p>'
                    , border: false
                    , bodyCssClass: 'panel-desc2'
                }
                , {
                    fieldLabel: 'Assigned staff',
                    id: 'my-stafflist-sales-manager',
                    name: 'mystafflist[]',
                    xtype: 'my-stafflist',
                    resizable: true
                    , value: (smsaved > 0) ? smsaved : ''
                }
    
            ]
        });
    
    });
    
    MODx.combo.stafflist = function (config) {
        config = config || {};
        Ext.applyIf(config, {
          name: 'stafflist'
        , hiddenName: 'stafflist'
        , displayField: 'fullname'
        , valueField: 'id'
        , typeAhead: true
        , selectOnFocus:true
        , editable: false
        , fields: ['fullname', 'id']
        , pageSize: 20
        , width: 300
            //,value: config.record.con_id   || ''
        , emptyText: _('empty text')
        , store: new Ext.data.JsonStore({
            id: 'id',
            autoLoad: true,
            root: 'results',
            dir: 'ASC',
            fields: ['fullname', 'id'],
            url: MODx.config.connectors_url + 'security/user.php',
            baseParams: {
                action: 'getList'
                        , usergroup: 7
                        , sort: 'fullname'
                        , dir: 'ASC'
                }
            })
        });
    MODx.combo.stafflist.superclass.constructor.call(this, config);
    };
    Ext.extend(MODx.combo.stafflist, MODx.combo.ComboBox);
    Ext.reg('my-stafflist', MODx.combo.stafflist);
    


    I'm hoping someone can help, I've only got so much hair wink Many thanks in advance!

    Phill

    Update: To clarify am running MODX Revolution 2.2.6-pl

    This question has been answered by peelay. See the first response.

    [ed. note: peelay last edited this post 13 years, 7 months ago.]
    • discuss.answer
      • 38865
      • 10 Posts
      Quote from: peelay at Feb 06, 2013, 06:46 PM

      Ext.onReady(function () {
      
          var usertabs = Ext.getCmp('modx-user-tabs');
          usertabs.add({
              title: 'Phybridge Portal',
              defaults: { labelWidth: 180 },
              layout: 'form',
              autoScroll: true,
              autoHeight: false,
              labelAlign: "left",
              labelWidth: 180,
              width: 800,
              height: 500,
              cls: 'main-wrapper',
              items: [
                  {
                  html: '<p style="margin-bottom:10px;">Select which Phybridge staff member is to be this person\'s assigned Sales Manager.</p>'
                      , border: false
                      , bodyCssClass: 'panel-desc2'
                  }
                  , {
                      fieldLabel: 'Assigned staff',
                      id: 'my-stafflist-sales-manager',
                      name: 'mystafflist[]',
                      xtype: 'my-stafflist',
                      resizable: true
                      , value: (smsaved > 0) ? smsaved : ''
                      , listeners: {
                          'select': { fn: function (data) { Ext.getCmp('modx-panel-user').markDirty(); } }
                      }
                  }
      
              ]
          });
      
      });
      


      Seems it's a self help community wink After a whole lot of digging and trial and error and in the end searching all the source .js files to find something similar I finally found the solution. Needed to add listener (which I already was pretty sure of) but also found out that you need to mark the user panel (not tab) as dirty to get the Save button active. Would be amazing if this could be documented somewhere, perhaps as part of Adding Custom Extension, if it is documented already please point the way! I'm sure there's more info I could learn there.

      Hope this helps others out there.

      Phill