We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37475
    • 25 Posts
    I folowed the instructions at:
    http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution
    to start develop a new extra in modx. Now I wonder how I will create a new class and database table. How do I do this in a easy way? The build.schema.php have static values. I change only those values or how do I do?
      • 33983 ☆ A M B ☆
      • 181 Posts
      Bingo,

      I recently released an extra that does this, it is called CMPGenerator.
      Try it out: http://modx.com/extras/package/cmpgenerator and see the docs: http://rtfm.modx.com/display/ADDON/CMPGenerator. File any issues if any on github.

      Note - fixed URL error [ed. note: jgulledge19 last edited this post 14 years, 8 months ago.]
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        The above documentation link needs to have the "." removed from the end of the URL.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 38266
          • 13 Posts
          The bad news is that it doesn't work sad
          I tried it few days ago and it wasn't able to create schema neither xpdo class. I tried with both options turned to 'yes' and I found 'no' and 'no' in the result fields in a grid. It had created only directories structure.

          But I went through tutorial and now I'm trying to find any detailed info on how to handle different types of form elements.
          1) I'd like to use regular dropdown. Currently I can build it with options from local storage, this way:
          {
                      xtype: 'combo'
                      ,fieldLabel: _('schedule.week_day')
                      ,name: 'week_day'
                      ,id: 'schedule-'+this.ident+'-week_day'
                      ,width: 200
                      ,lazyLoad: true
                      ,editable: false
                      ,mode: 'local'
                      ,store: [[1, 'mon'], [2, 'tue']]
                      }
          

          But it sends zero as value whatever selected. What could be wrong? And how do I make default value (selected and shown in the field after window loaded)?

          2. Is there way to modify value shown in the grid? I have related model id's column. Sure I want to show names instead of ids. Currently I've just added another column in processor with names and I show it in the grid while ids column is hidden. I don't like this solution as I'd like to use in-row editing with combo fields. How should I make it better?

          Thanks for any advices!
            • 29661
            • 116 Posts
            Quote from: youroff at Jan 09, 2012, 06:04 PM

            But it sends zero as value whatever selected. What could be wrong? And how do I make default value (selected and shown in the field after window loaded)?

            Try update your store to this:
            ,store: new Ext.data.SimpleStore({
                fields: ['id','dayName']
                ,data: [[1,'mon'],[2,'tue']]
            })


            Quote from: youroff at Jan 09, 2012, 06:04 PM

            2. Is there way to modify value shown in the grid? I have related model id's column. Sure I want to show names instead of ids. Currently I've just added another column in processor with names and I show it in the grid while ids column is hidden. I don't like this solution as I'd like to use in-row editing with combo fields. How should I make it better?

            Try to add
            ,displayField: 'dayName'
            ,valueField: 'id'


            to your combo definition and
            ,editor: { xtype: 'your-combo-xtype', renderer: true}

            to your grid column definition
              --
              John
              @theboxer
              • 38266
              • 13 Posts
              Unfortunately it's not enough. I tried that also. And final solution was to add hiddenValue: 'id' statement to config object. Yes, totally unobvious...