On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Quote from: Bruno17 at Apr 11, 2014, 07:01 PM
    Its better to use the MIGX - configurator for more advanced stuff like that.

    Go to the MIGX - CMP

    Create a new configuration with an unique name, for example:

    myfirstconfig


    put this same name also into the field 'unique MIGX ID'

    Then create your columns and Tabs with fields.
    For your column, where you want to render the nested MIGX, use another name,
    for example:

    renderunits


    select the this.renderChunk - renderer for that column
    and put this getImageList - call into the renderChunk Tpl - field (textarea):

    [[getImageList? &value=`[[+units]]` &tpl=`unitColumn`]]


    Don't forget to remove the old formtabs and columns from your MIGX - TV
    and put the name of your configuration

    myfirstconfig


    into the field 'configs' of your MIGX - TV



    This makes so much sense now - thanks for the help Bruno
    • Hi, Jim!
      firefox raise error:

      TypeError: column.rendereroptions is undefined
      name : column.rendereroptions.name

      what's wrong?

      P.S.: sorry for my bad english
      • Quote from: tramp1357 at May 07, 2014, 06:48 AM
        Hi, Jim!
        firefox raise error:

        TypeError: column.rendereroptions is undefined
        name : column.rendereroptions.name

        what's wrong?

        P.S.: sorry for my bad english

        Hi Tramp1357,

        Firstly, please try your ModX installation in an alternative browser. This will show whether or not the issue is browser related.

        If you cannot replicate the problem in another browser, please let me know what version of Firefox you're using and if you're a Mac or PC user and I'll do my best to help.

        If the problem occurs in whatever browser you're using, then you have most likely not copied across all the code.

        Make sure you have done the following:

        1. Edit: core/components/migx/model/migx/migx.class.php

        After this block of code (line 855):

        if (isset($column['renderer']) && !empty($column['renderer'])) {
        $col['renderer'] = $column['renderer'];
        $handlers[] = $column['renderer'];
        }

        ...add this code:

        if (isset($column['rendereroptions']) && !empty($column['rendereroptions'])) {
        $col['rendereroptions'] = $column['rendereroptions'];
        $handlers[] = $column['rendereroptions'];
        }

        2. Check that your MIGX tv includes json that looks similar to the following example - notice the "renderoptions" key:

        {"header": "Client", "width": "160", "sortable": "false", "dataIndex": "client", "renderer": "this.renderSnippet", "rendereroptions":{"name":"ExampleSnippet", "options":"height=22&width=90"}},

        Let me know how you get on.

        Kind regards

        Jim

        • Hi Bruno!

          I was wondering if you could help me with my problem. I've been digging information about this for awhile now. There are methods i've tried upon reading these threads. So here it is:

          I have created an inputTV named "product_select" where all products from different resources are listed in Listbox (single select). The option is setup like this [[+pagetitle]]==[[+id]]. So on Listbox select option, only the pagetitle is being displayed but we know that the value is the resource ID alone. So, when it's done, what will be display on MIGX grid will be the ID alone.

          Instead of the ID being displayed on the table grid, i want to grab the pagetitle of the resource instead, but of course in frontend i want the ID value.

          Here's my Form Tabs:

          [
              {
                  "fields": [
                      {
                          "field": "product",
                          "caption": "Product",
                          "description": "select a product here",
                          "inputTV": "product_select"
                      }
                  ]
              }
          ]


          and here's my Grid Columns:

          [
              {
                  "header": "Products",
                  "dataIndex": "product",
                  "renderer": "this.renderChunk",
                  "renderchunktpl": "[[getResources? &parents=`-1` &resources=`[[+product]]` &tpl=`@INLINE [[+pagetitle]]`]]"
              }
          ]



          But still i can't get it working. Still the table grid is displaying the resource ID not the pagetitle. I there any other way to do it? or i'm almost there but just missing some things smiley Thanks a lot
          • try it with getResourceField and do not use the same fieldname for the rendered column:



            [
                {
                    "header": "Products",
                    "dataIndex": "renderproduct",
                    "renderer": "this.renderChunk",
                    "renderchunktpl":"[[getResourceField? &id=`[[+product]]`]]"
                }
            ]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • Hello Bruno,

              Thanks for responding smiley I greatly appreciate it.

              I tried the configuration above. But the grid table won't display anything instead. For what i understand is that because the fieldname "renderproduct" is not the same as the fieldname in the form tab. I'm sorry for i'm not really getting the logic yet, and i just assume that the placeholder "[[+product]]" is the value from the form tab item that being added, am i right?

              To explain more my problem, Here are some images i added smiley thanks a lot

              Popup when adding item: http://screencast.com/t/NqEIa4u02iR
              Manager grid table: http://screencast.com/t/hon3GxX3S
              • Hello, Bruno17
                I'm using MIGX (not MIGXdb) and encountered a problem.
                I created MIGX configuration "views" - a list of images with a single box img.
                Then I created a variable views and made her the type of input MIDX, the configuration of "views".
                Then I created MIGX configuration options, and one of the fields (views) prelingual previously created variable views.

                Then did everything as You wrote:
                1. added RendererOptions (name -> "listViews")

                2. created chunk "listViews" with the text
                [[!getImageList? &value=`[[+views]]` &tpl=`viewsTpl`]]

                3. created chunk "viewsTpl" with the text
                <img src="[[pThumb?input=`/assets/images/[[+img]]`&options=`w=40&h=50`]]"/>

                As a result, I can add some pictures and then they are displayed correctly in the grid... until page reload.
                After reboot the box looks empty, although if you look through the console, the value is:

                => Array
                (
                [tv_id] => 18
                [value_id] => 132
                [value] => [{
                "MIGX_id":"1",
                "option":"steel",
                "delta":"0",
                the "views":"<img src=\"/assets/components/phpthumbof/cache/img1.f0af6888de2028e181c0a09115c92beb.jpg\"/> <img src=\"/assets/components/phpthumbof/cache/img2.7fd24f46ae1a1b84d4600643606606bb.jpg\"/> <img src=\"/assets/components/phpthumbof/cache/img3.95a2a7c389845d355abe5168ee7ce45b.jpg\"/> ",
                "views_ro":"",
                "_this.value":"[
                {\"MIGX_id\":\"1\",\"img\":\"products/mods/mechanical/hammer/img1.jpg\"},
                {\"MIGX_id\":\"2\",\"img\":\"products/mods/mechanical/hammer/img2.jpg\"},
                {\"MIGX_id\":\"3\",\"img\":\"products/mods/mechanical/hammer/img3.jpg\"}
                ]"
                }]
                )

                What did I do wrong?
                • Hi friends! I have some problems with MIGX renderChunk & ColorPicker. Column "Цвет" not work. Why?
                  I use this in my MIGX TV.
                  [{"caption":"Характеристики", "fields": [
                      {"field":"color","caption":"Цвет","inputTV":"colorpicker"},
                      {"field":"icon","caption":"Иконка","inputTV":"icon"}, 
                      {"field":"title","caption":"Заголовок"},
                      {"field":"subtitle","caption":"Подзаголовок"},
                      {"field":"link","caption":"Ссылка"}
                    ]
                  }]
                  


                  columns:
                  [{
                    "header": "Цвет", "width": "20", "dataIndex":"render_color",
                  "renderer":"this.renderChunk","renderchunktpl":"tplColor"
                  },{
                    "header": "Иконка", "width": "50", "dataIndex":"icon","renderer": "this.renderImage"
                  },{
                    "header": "Заголовок", "dataIndex": "title"
                  },{
                    "header": "Подзаголовок", "dataIndex": "subtitle"
                  },{
                    "header": "Ссылка", "dataIndex": "link"
                  }]
                  


                  and chunk tplColor:
                  <div style="width: 20px; height: 20px; background: [[+color]]"></div>