We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36192 ☆ A M B ☆
    • 55 Posts

    Is there an updated step-by-step for setting this up?

    I was able to setup the TV and see the chunks in the TV when editing the resource. The call to getImageList doesn't seem to fire on my the front end using:

    [[!getImageList? &tvname=`chunklist` &tpl=`@FIELD:name` &where=`{"selected":"1"}`]]


    And I'm a bit unclear on how the &tpl field is used.

    I'm running ModX 2.2.10 and MIGX 2.5.6

    Many thanks!

      • 4172
      • 5,888 Posts
      what is the output (the json-string with your items) when you put this tag to your template/content:

      [[*chunklist]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 36192 ☆ A M B ☆
        • 55 Posts
        Bruno,

        Thanks for the swift reply. It turns out I was missing an opening bracket...

        One more question - when I update the category id in the chunklist tv default value it doesn't seem to pick up the new category's chunks when I edit a resource that uses the chunklist tv, it defaults to category w/ id of 11. I've tried clearing the site cache to no avail... any ideas?

        Thanks for writing MIGX- it's a truly wonderful addition ModX. [ed. note: tonkatrucker last edited this post 12 years, 10 months ago.]
          • 4172
          • 5,888 Posts
          default-values doesn't update, once a value is stored.

          There is a better option to do this now (with input-options) with the next coming MIGX - Version.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 36192 ☆ A M B ☆
            • 55 Posts
            Quote from: Bruno17 at Nov 05, 2013, 03:11 AM
            default-values doesn't update, once a value is stored.

            There is a better option to do this now (with input-options) with the next coming MIGX - Version.

            Thanks, Bruno. Any sense of when the next MIGX version will be available?

            Also, is it possible to have some chunks default to "show" for all pages that use the template w/ the chunklist TV?
              • 4172
              • 5,888 Posts
              This is a working configuration now possible with MIGX 2.2.9

              This post is an update of that one, where we had the initial chunklist in default-value:
              https://forums.modx.com/thread/79757/sortable-editable-list-of-checkboxes#dis-post-439314

              The chunk-list goes now to input-option-values as json and is updated with new items, when you add new chunks to the category.
              you can add additional fields with default values to the catched fields.

              here is my Test-Configuration

              created some chunks in category with id 11 with some text and an additional placeholder to demonstrate how you can add addional custom-infos to each item
              [[+extra]]


              migx - TV

              name: chunklist
              configurations: chunklist
              input option values
              @EVAL $modx->runSnippet('migxLoopCollection',array('classname'=>'modChunk','where'=>'{"category":"11"}','addfields'=>'selected:0,editablefields:selected','selectfields'=>'id,name','toJsonPlaceholder'=>'json')); return $modx->getPlaceholder('json');
              


              migx - Configuration

              name: chunklist
              import/export - json:
              {"formtabs":"[{\"MIGX_id\":\"1\",\"caption\":\"chunktest\",\"fields\":\"[{\\\"MIGX_id\\\":\\\"1\\\",\\\"field\\\":\\\"name\\\",\\\"caption\\\":\\\"Chunkname\\\",\\\"inputTV\\\":\\\"\\\",\\\"inputTVtype\\\":\\\"\\\",\\\"configs\\\":\\\"\\\",\\\"sourceFrom\\\":\\\"config\\\",\\\"sources\\\":\\\"\\\",\\\"inputOptionValues\\\":\\\"\\\",\\\"default\\\":\\\"\\\"},{\\\"MIGX_id\\\":\\\"2\\\",\\\"field\\\":\\\"extra\\\",\\\"caption\\\":\\\"Extra\\\",\\\"inputTV\\\":\\\"\\\",\\\"inputTVtype\\\":\\\"\\\",\\\"configs\\\":\\\"\\\",\\\"sourceFrom\\\":\\\"config\\\",\\\"sources\\\":\\\"\\\",\\\"inputOptionValues\\\":\\\"\\\",\\\"default\\\":\\\"\\\"},{\\\"MIGX_id\\\":\\\"3\\\",\\\"field\\\":\\\"selected\\\",\\\"caption\\\":\\\"\\\",\\\"inputTV\\\":\\\"\\\",\\\"inputTVtype\\\":\\\"hidden\\\",\\\"configs\\\":\\\"\\\",\\\"sourceFrom\\\":\\\"config\\\",\\\"sources\\\":\\\"\\\",\\\"inputOptionValues\\\":\\\"yes==1||no==0\\\",\\\"default\\\":\\\"\\\"},{\\\"MIGX_id\\\":\\\"4\\\",\\\"field\\\":\\\"selected_ro\\\",\\\"caption\\\":\\\"\\\",\\\"inputTV\\\":\\\"\\\",\\\"inputTVtype\\\":\\\"hidden\\\",\\\"configs\\\":\\\"\\\",\\\"sourceFrom\\\":\\\"config\\\",\\\"sources\\\":\\\"\\\",\\\"inputOptionValues\\\":\\\"\\\",\\\"default\\\":\\\"\\\"}]\"}]","contextmenus":"","actionbuttons":"","columnbuttons":"","filters":"","extended":{"migx_add":"","formcaption":"","win_id":"chunklist","multiple_formtabs":"","extrahandlers":"this.handleColumnSwitch","packageName":"","classname":"","task":"","getlistsort":"","getlistsortdir":"","use_custom_prefix":"0","prefix":"","grid":"","gridload_mode":"1","check_resid":"1","check_resid_TV":"","join_alias":"","getlistwhere":"","joins":"","cmpmaincaption":"","cmptabcaption":"","cmptabdescription":"","cmptabcontroller":""},"columns":"[{\"MIGX_id\":\"1\",\"header\":\"Chunk\",\"dataIndex\":\"name\",\"width\":\"10\",\"sortable\":\"false\",\"show_in_grid\":\"1\",\"renderer\":\"\"},{\"MIGX_id\":\"2\",\"header\":\"Selected\",\"dataIndex\":\"selected\",\"width\":\"10\",\"sortable\":\"true\",\"show_in_grid\":\"1\",\"renderer\":\"this.renderSwitchStatusOptions\",\"renderoptions\":\"[{\\\"MIGX_id\\\":\\\"1\\\",\\\"name\\\":\\\"selected\\\",\\\"value\\\":\\\"1\\\",\\\"clickaction\\\":\\\"switchOption\\\",\\\"handler\\\":\\\"\\\",\\\"image\\\":\\\"assets\\\\\\\/components\\\\\\\/migx\\\\\\\/style\\\\\\\/images\\\\\\\/tick.png\\\"},{\\\"MIGX_id\\\":\\\"2\\\",\\\"name\\\":\\\"unselected\\\",\\\"value\\\":\\\"0\\\",\\\"clickaction\\\":\\\"switchOption\\\",\\\"handler\\\":\\\"\\\",\\\"image\\\":\\\"assets\\\\\\\/components\\\\\\\/migx\\\\\\\/style\\\\\\\/images\\\\\\\/cross.png\\\"}]\"}]"}
              


              frontend

              [[!getImageList? &tvname=`chunklist` &tpl=`@FIELD:name` &where=`{"selected":"1"}`]]
              




              [ed. note: Bruno17 last edited this post 12 years, 10 months ago.]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 4172
                • 5,888 Posts
                Quote from: tonkatrucker at Nov 05, 2013, 09:34 AM

                Also, is it possible to have some chunks default to "show" for all pages that use the template w/ the chunklist TV?


                If you want to have some chunks preselected you can add a script, which does modify the json-output before returning it.
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 41331
                  • 13 Posts
                  Michael Leipold-Haas Reply #38, 12 years, 10 months ago
                  Hello Bruno,

                  this works great!

                  But can you show me how can I display all available chunks of a category as default and "unchecked"?
                  I don't wanna add every chunk manually ;-)

                  Please see my attachment for further description.

                  Thanks a lot

                  Michael
                    • 4172
                    • 5,888 Posts

                    But can you show me how can I display all available chunks of a category as default and "unchecked"?
                    I don't wanna add every chunk manually ;-)

                    this really should do that (since version 2.2.9):
                    https://forums.modx.com/thread/79757/sortable-editable-list-of-checkboxes?page=4#dis-post-483240

                    doesn't it?

                    don't forget to change the category-id here:

                    'where'=>'{"category":"11"}'


                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 41331
                      • 13 Posts
                      Michael Leipold-Haas Reply #40, 12 years, 10 months ago
                      'where'=>'{"category":"11"}'

                      Hi Bruno,

                      thanks man, it was my fault ;-)

                      I thought I had the right category id, but it was the number of the chunks in the category ;-)
                      MIGX is one of the best modx extras, especially for customer editing of resources, very good!

                      I have just a last little issue with the example.

                      The image for activate/deactivate a chunk in the tv is undefined on first load until i click once on the image button. then the image is showing. Do you have an idea what I'm doing wrong or how can I fix that?

                      See attachement ...

                      Greetings

                      Michael