We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    Hi, I'm using renderChunk exactly as described here: http://forums.modx.com/thread/?thread=80338

    But I want to use it to show pagetitles instead of ids.
    My renderChunk chunk is called migxPagetitleTpl and it has this code in it:

    '[[!#[[+link]].pagetitle]]' (id: [[+link]])


    (FastField is installed).

    What happens is: everytime I add an item, some of the text gets duplicated. Very strange, see screenshot 1.

    I also tried with just this code in migxPagetitleTpl:

    [[!#[[+link]].pagetitle]]


    When I do this, the pagetitle is only rendered for the last added page. Strange isn't it! See screenshot 2.

    What could be going on? Am I doing something wrong?
      • 4172
      • 5,888 Posts
      use another column-name for the column, where you have the renderChunk-renderer

      not 'link', but for example 'render_link'

      in your columns - setup
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 19328
        • 433 Posts
        Hmm, I changed all the places I used the word 'link' (also in the form tabs etc.) but the same behaviour is still there...

        This is the export of the migx config:

        {
          "formtabs":[
            {
              "MIGX_id":1,
              "caption":"Footermenu",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":1,
                  "field":"menutitel",
                  "caption":"Menutitel",
                  "description":"De menutitel zoals deze in het footermenu moet verschijnen,",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"[]",
                  "inputOptionValues":"",
                  "default":""
                },
                {
                  "MIGX_id":2,
                  "field":"gelinktepagina",
                  "caption":"Gelinkte pagina",
                  "description":"Naar welke pagina op de website moet dit menu-item linken?",
                  "description_is_code":"0",
                  "inputTV":"migx_documentlijst",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"[]",
                  "inputOptionValues":"",
                  "default":""
                },
                {
                  "MIGX_id":3,
                  "field":"externelink",
                  "caption":"OF: Externe link",
                  "description":"Als dit menu-item moet verwijzen naar een externe website, voeg dan hier de gehele url in, inclusief http:\/\/",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"[]",
                  "inputOptionValues":"",
                  "default":""
                }
              ]
            }
          ],
          "contextmenus":"",
          "actionbuttons":"",
          "columnbuttons":"",
          "filters":"[]",
          "extended":{
            "migx_add":"Voeg menu-item toe",
            "formcaption":"Footermenu",
            "update_win_title":"Footermenu",
            "win_id":"migx_footermenu",
            "maxRecords":"",
            "addNewItemAt":"bottom",
            "multiple_formtabs":"",
            "actionbuttonsperrow":4,
            "winbuttonslist":"",
            "extrahandlers":"this.handleColumnSwitch",
            "filtersperrow":4,
            "packageName":"",
            "classname":"",
            "task":"",
            "getlistsort":"",
            "getlistsortdir":"",
            "use_custom_prefix":"0",
            "prefix":"",
            "grid":"",
            "gridload_mode":1,
            "check_resid":1,
            "check_resid_TV":"",
            "join_alias":"",
            "has_jointable":"yes",
            "getlistwhere":"",
            "joins":"",
            "cmpmaincaption":"",
            "cmptabcaption":"",
            "cmptabdescription":"",
            "cmptabcontroller":"",
            "winbuttons":"",
            "onsubmitsuccess":"",
            "submitparams":""
          },
          "columns":[
            {
              "MIGX_id":2,
              "header":"Menutitel",
              "dataIndex":"menutitel",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"[]"
            },
            {
              "MIGX_id":1,
              "header":"Pagina",
              "dataIndex":"gelinktepagina",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"this.renderChunk",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":[
                {
                  "MIGX_id":1,
                  "name":"migxPagetitleTpl",
                  "value":"",
                  "clickaction":"",
                  "handler":"",
                  "image":""
                }
              ]
            },
            {
              "MIGX_id":3,
              "header":"Externe link",
              "dataIndex":"externelink",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":"[]"
            }
          ]
        }


        Am I doing something wrong?
          • 4172
          • 5,888 Posts
          change it only here:

          "dataIndex":"gelinktepagina",


          don't use one of the field-names for a column, which you are using to render a chunk
          and if fastField - doesn't work here, try to use getResourceField
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 19328
            • 433 Posts
            Yes, it's working! Thank you Bruno! I didn't understand you at first, now I do smiley

            getResourceField didn't work for me (nothing displayed anymore in the column)
            But I used this (fastField):

            [[#[[+link]].pagetitle]] (id [[+link]])


            Thanks again!
              • 40088
              • 708 Posts
              Revo 2.3.1
              MIGX 2.8.1

              I have a working MIGX grid with a “Link” column that displays the resource ID of the page being linked to, but I would rather show the page title instead, though I'm unable to get the above solution to work.

              Here's the original code:

              Page call
              [[!getImageList?
                  &tvname=`Slideshow`
                  &tpl=`Slideshow Link`]]


              Slideshow Link Chunk
              <a href="[[~[[+link]]]]"><img src="[[+image]]" width="800" height="400" alt="[[+alt]]" /></a>


              Slideshow TV

              Form Tabs
              [
                      {"caption":"Slideshow Images", "fields": [
                      {"field":"image","caption":"Image","inputTVtype":"image"},
                      {"field":"alt","caption":"Alt Text","inputTVtype":"text"},
                      {"field":"link","caption":"Link","inputTVtype":"resourcelist"}
                      ]}
              ]

              Grid Columns
              [
                      {"header": "Image", "sortable": "false", "dataIndex": "image","renderer":"this.renderImage"},
                      {"header": "Alt Text", "sortable": "true", "dataIndex": "alt"},
                      {"header": "Link", "sortable": "true", "dataIndex": "link"}
              ]
                Todd
                • 4172
                • 5,888 Posts
                use the MIGX - configurator for configuring the formtabs and columns.
                Use another dataIndex (field) for the rendered column, for example 'render_link'
                Use the this.renderChunk - renderer and put
                [[#[[+link]].pagetitle]]

                into the renderChunk Tpl - field

                Fastfield or pdoTools has to be installed to use fastfield-tags.

                empty the formtabs and columns - inputs in your TV's input-options and put the name of the MIGX-configuration into the 'configs' - input

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

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 40088
                  • 708 Posts
                  Nice. Thank you, Bruno.

                  Clearly I have a lot to learn about how MIGX works.
                    Todd
                    • 44665
                    • 60 Posts
                    sebastian-marinescu Reply #9, 9 years, 6 months ago
                    Quote from: Bruno17 at Oct 13, 2014, 05:59 AM
                    use the MIGX - configurator for configuring the formtabs and columns.
                    Use another dataIndex (field) for the rendered column, for example 'render_link'
                    Use the this.renderChunk - renderer and put
                    [[#[[+link]].pagetitle]]

                    into the renderChunk Tpl - field

                    Fastfield or pdoTools has to be installed to use fastfield-tags.

                    empty the formtabs and columns - inputs in your TV's input-options and put the name of the MIGX-configuration into the 'configs' - input


                    Is "this.renderChunk" not working if defined in the TV input-options?
                      • 4172
                      • 5,888 Posts
                      This should work, too, but you would need to know the json-syntax exactly.
                      You can get the syntax, by exporting the generated json or by 'edit raw' to get the formtabs and columns as editable json-string
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!