We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38266
    • 13 Posts
    I stuck with ComboBox widget. It sends value instead of id even though I use it this way:
    MODx.combo.WeekDay = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            displayField: 'name'
            ,valueField: 'id'
            ,mode: 'local'
            ,store: new Ext.data.SimpleStore({
                fields: ['id', 'name'],
                data: [[1, 'mon'], [2, 'tue']]
            })
            ,emptyText: 'Week day'
            ,editable: false
        });
        MODx.combo.WeekDay.superclass.constructor.call(this,config);
    };
    Ext.extend(MODx.combo.WeekDay, MODx.combo.ComboBox);
    Ext.reg('schedule-combo-weekday', MODx.combo.WeekDay);
    
    //Then in grid config:
    {
                xtype: 'schedule-combo-weekday'
                ,fieldLabel: _('schedule.week_day')
                ,name: 'week_day'
                ,id: 'schedule-'+this.ident+'-week_day'
                ,width: 200
    }
    


    It seems valueField totally doesn't work. I see the field from 'displayField' in form array before submit. What am I doing wrong? Pleeeeease help!
      • 38266
      • 13 Posts
      Er... I added hiddenName: 'week_day' and it got work as expected. Am I alone who thinks ExtJS is a bit crazy?
        • 28215
        • 4,149 Posts
        No, you are not alone. Powerful, but crazy.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 38266
          • 13 Posts
          Shaun, I have another issue... How do I config timefield for in row editing? Simple way to add ",editor: { xtype: 'timefield' ,renderer: true}" to field definition doesn't work. Can you help with that please?
            • 29661
            • 116 Posts
            4 me is working fine
            ,editor: { xtype: 'timefield', format: MODx.config.manager_time_format}

            I am passing to grid same time format as I have in MODx.config.manager_time_format
              --
              John
              @theboxer
              • 38266
              • 13 Posts
              Hmm.. I tried that similar way. But I get this error: Uncaught TypeError: Cannot read property 'mode' of undefined

              And It couldn't be the reason why it didn't work before as timefield has some default format anyway.
                • 38266
                • 13 Posts
                Ah, wait a minute... I hadn't set renderer to true. Now it works.
                  • 29661
                  • 116 Posts
                  Crazy, I get exactly same error when I have renderer set to true, I have to set it to false to fix the error...
                    --
                    John
                    @theboxer
                    • 38266
                    • 13 Posts
                    That's right. It have to be false because there is no custom renderer for this xtype in MODx class (or something like this). But anyway it still doesn't work well... For example when you double click at field you see clear combobox without initial value. Not convinient... sad It's left to learn how to make custom renderer.
                      • 29661
                      • 116 Posts
                      When I double-click on field that has some value (8:00 for example), combo appears with 8:00 init value
                        --
                        John
                        @theboxer