We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    How would one go about creating a customizable set of checkboxes? Just use the usual grid structure, with one of the grid fields being a single checkbox? Then use a custom snippet to output the values of the checked boxes?
      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
      • 4172
      • 5,888 Posts
      can you tell a bit more about it, Susan?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I want to have a list of checkboxes in a TV. I'd want to be able to re-order the checkboxes in the list.

        This is to select blocks (chunks) in a sidebar. For example, some pages might want a search form, a side menu, and contact information, some might want contact information, a 'whats new" block, and a login block.

        The only problem with a standard checkbox TV is that you can't re-order the list of items.

          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
          • 33976 ☆ A M B ☆
          • 571 Posts
          Susan,

          A while back MadeMyDay did that with sortable checkbox (i guess Bruno worked on this!).

          I used the TV to build Asides. But this component isn't flexible enough (and working up to Revo 2.1, unless you grab a quick & dirty refactoring i did on Github).

          Hope that might help smiley
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Got the latest Asides from github; trying to edit a resource with it produces a blank manager page. No errors, no javascript errors.

            Sortable checkbox package link is dead.

            Another GitHub link for a package that works https://github.com/meltingmedia/Asides

            Thank you! Just what I needed! [ed. note: sottwell last edited this post 13 years, 11 months ago.]
              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
              • 33976 ☆ A M B ☆
              • 571 Posts
              Did you build the package or grab an already built package ?
              Current packages aren't working with Revo 2.2+ (adding a working one right now)

              Edit : there you go (upgrading from another version has not been tested, sorry) [ed. note: romain last edited this post 13 years, 11 months ago.]
                • 4172
                • 5,888 Posts
                The next version of MIGX will make this possible in a very configurable and flexible way.

                you can define multiple possible options (with an image for each option) (not only checked,unchecked) for each column and choose a special renderer for this column.

                Then, when you click on that column it will switch to the next option and display its image.
                For example, if you have two options for a field called selected and two options (0 and 1) you can choose a cross for 0 and a tick for 1

                there is also a new snippet to fill the default-value of the MIGX-TV with chunknames of a given category. This will initially show all chunks as MIGX-records.

                Of course its also possible to add additional fields as usual in MIGX, if you want to have additional properties for each chunk on different resources.

                First Tests looks good, so far



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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  I'd like to test that, Bruno. I'll try it out on my 2.3 installation.
                    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
                    • 4172
                    • 5,888 Posts
                    There is an updated version of this post with new instructions now here:
                    https://forums.modx.com/thread/79757/sortable-editable-list-of-checkboxes?page=4#dis-post-483240


                    here is my Test-Configuration

                    created some chunks in category with id 11 with some text and an additional placeholder
                    [[+extra]]


                    migx - TV

                    name: chunklist
                    configurations: chunklist
                    default-value: @EVAL return $modx->runSnippet('migxChunklistToJson',array('category'=>'11'));

                    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"}`]]
                    


                    Tested with the latest github-package from today:

                    https://github.com/Bruno17/MIGX/tree/master/core/packages


                    [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!
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      I've installed the Asides custom TV, and it works beautifully- except for the output. Under each block I'm getting an underscore and some kind of numeric indicator

                      <hr>
                      1/2

                      <hr>
                      2/2

                      I presume this is from some kind of output tpl, but I don't see any way to modify that. Can't seem to get rid of the aside.wrapper property. [ed. note: sottwell last edited this post 13 years, 11 months ago.]
                        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