We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37984
    • 215 Posts
    I'm using MIGX for a homepage slider, and would like to limit the amount of datasets (slides) that can be added so that the client doesn't add 20 slides to the homepage. Anyone know any way to accomplish this?

    My apologies if this is a stupid question, but this is the first time I've used MIGX.
      Jesse Couch
      MODX Aficionado, Front-End Designer & Developer
      http://www.designcouch.com
      • 4172
      • 5,888 Posts
      its possible now with this additions (will be in the next version)
      https://github.com/Bruno17/MIGX/commit/31d6f4f9878462f3bfdfadba7c85f6e352b70e76

      you will need to use the MIGX - configurator to configure your TV, not the input-options, and put the name of the configuration into 'configs' in the TV's input-options.

      There is now a field 'max MIGX records' on the Configurator-Settings-tab.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • Just saw this and tried it... yet it didnt work... Any ideas Bruno?
          GEL STUDIOS
          MODX Professional | MODX Ambassador

          Website | Email | Twitter | Facebook
          • 4172
          • 5,888 Posts
          what exactly does not work?
          Limiting the max possible records with this setting (from MIGX-configurator) does work for me.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
          • The limiting bit... Still allows me to add more...

            What should be the default behaviour when you try to add an extra?
              GEL STUDIOS
              MODX Professional | MODX Ambassador

              Website | Email | Twitter | Facebook
              • 4172
              • 5,888 Posts
              you should get an alert with 'max amount of records reached' as soon as you click the 'add item' - button

              	,addItem: function(btn,e) {
              	    var maxRecords =  parseInt('{/literal}{$customconfigs.maxRecords}{literal}');
                      var s=this.getStore();
                      if(maxRecords != 0 && s.getCount() >= maxRecords){
                          alert ('[[%migx.max_records_alert]]');
                          return;            
                      }
              		this.loadWin(btn,e,s.getCount(),'a');
              	}
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 12410
                • 353 Posts
                Hi Bruno,

                My Form Tab is:

                [
                
                {"caption":"Menu Item 1", "fields":[
                    {"field":"text1","caption":"Menu Item 1"}
                ]},
                
                {"caption":"Menu Item 2", "fields":[
                    {"field":"text2","caption":"Menu Item 2"}
                ]}
                
                ]


                ...and Grid Column is

                [
                
                [
                
                {"header": "Menu Item 1", "width": "160", "sortable": "true", "dataIndex": "text1"},
                
                {"header": "Menu Item 2", "width": "160", "sortable": "true", "dataIndex": "text2"}
                
                ]
                
                ]


                ...And I only want the user to be able to add 1 row in Migx. How do I adjust the above code (or other) to achieve this please? I don't quite understand the MIGX - configurator reference above. I'm using MODX Revolution 2.2.13-pl (traditional) and Migx 2.6.7.
                Thanks
                  • 4172
                  • 5,888 Posts
                  you will need to use the MIGX - configurator to configure your TV, not the input-options, and put the name of the configuration into 'configs' in the TV's input-options.

                  exactly as its posted there.

                  Create a new Configuration within the MIGX-configurator-CMP
                  Name it for example 'menuitems'
                  Fill out the field 'max MIGX records' - in your case with '1'
                  Fill out the Formtabs and Columns

                  Go to your TV's input-options.

                  Fill the field 'configs' with 'menuitems'
                  Let the formtabs and columns empty, because you did configure them within the MIGX-Configurator
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 12410
                    • 353 Posts
                    Gotcha, superb!
                    • Hi, does it work also with a migxdb tv or just with standard migx?
                      thanks
                        TilliLab | MODX Ambassador
                        website