We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    Normally you would use the MIGX - configurator - CMP, as soon, as you have some advanced configurations and you wouldn't use the formtabs and columns - fields for configuration.


    Use the MIGX-configurator-CMP and create a new Configuration there with a unique name.
    There you can set the renderChunk - renderer for a column and put the chunk-code into a textarea-input-field.

    Than in the input-options for your MIGX-TV empty the fields for formtabs and columns and put the name of the configuration into input-options-field 'configs'

    But, if you still want to use the columns - input-option for configuration this is an exported columns - configuration as an example:

    [{"MIGX_id":"1","header":"Bild","dataIndex":"renderimage","width":"150","sortable":"true","show_in_grid":"1","renderer":"this.renderChunk","clickaction":"","selectorconfig":"","renderchunktpl":"<img src=\"/connectors/system/phpthumb.php?imageplus=1&wctx=mgr&f=png&q=90&w=150&source=1&src=[[renderImagePlus? &value=`[[+image]]`]]&sw=3000&sh=1800&sx=0&sy=116\" >","renderoptions":"[]"},{"MIGX_id":2,"header":"Titel","dataIndex":"title","width":150,"sortable":"false","show_in_grid":1,"renderer":"","clickaction":"","selectorconfig":"","renderchunktpl":"","renderoptions":"[]"},{"MIGX_id":3,"header":"Beschreibung","dataIndex":"desc","width":300,"sortable":"false","show_in_grid":1,"renderer":"","clickaction":"","selectorconfig":"","renderchunktpl":"","renderoptions":"[]"}]
    


    you can try something like that within the columns - configuration.
    The part after "renderchunktpl": is the chunk-code to render an image-plus - image into a MIGX - grid with a special snippet called 'renderImagePlus'
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 46006
      • 17 Posts
      Thanks for taking the time to explain this in more detail. I'll go through your notes and see if I can get it working.
        • 37042
        • 384 Posts
        Bruno, renderChunk sounds interesting. I wonder can you give us an example of how it might be used in a real client project. What does it do? Why is this beneficial? How would a client / editor use it or experience it?
          ...
          • 10555
          • 32 Posts
          I have chunks of code which I want rendered in the grid my multiColumn grid contains many elements which I would like to display within the grid ... does this have to be done via the migx CMP .. or can it be done via code. Below is my first attempt which is incorrect. I have many fields within the multiColumn which makes up a sortable email template. and I would like to be able to see the complete chunk in each row of the migx grid... is there away I can render this.

          Chuck:
          <tr>
          <td id="header" class="w640" width="640" align="center" bgcolor="#ffffff">
          <div class="w640" align="center" style="text-align: center; margin-top:10px; margin-bottom:10px;">
          <a href=[[~[[+id]]]]>
          <img src="[[+headerImage:phpthumbof=`w=640`]]"class="logoResize" border="0"/>
          </a>
          </div>
          </td>
          </tr>

          [{
              "header": "Row Format"
              ,"width": "100"
              ,"sortable": "true"
              ,"dataIndex": "MIGX_formname"
          },{
              "header": "First"
              ,"width": "160"
              ,"sortable": "false"
              ,"dataIndex": "resource"
              ,"renderer":"this.renderChunk"
          },{
              "header": "Second"
              ,"width": "160"
              ,"sortable": "false"
              ,"dataIndex": "resource"
              ,"renderer": "this.renderChunk"
          }]
            • 4172
            • 5,888 Posts
            you can try this.
            If this doesn't work you can try to use the MIGX - configurator.

            [{
                "header": "Row Format"
                ,"width": "100"
                ,"sortable": "true"
                ,"dataIndex": "MIGX_formname"
            },{
                "header": "First"
                ,"width": "160"
                ,"sortable": "false"
                ,"dataIndex": "resource"
                ,"renderer":"this.renderChunk"
            },{
                "header": "Second"
                ,"width": "160"
                ,"sortable": "false"
                ,"dataIndex": "rendered"
                ,"renderer": "this.renderChunk"
                ,"renderchunktpl":"<tr>\n<td id=\"header\" class=\"w640\" width=\"640\" align=\"center\" bgcolor=\"#ffffff\">\n<div class=\"w640\" align=\"center\" style=\"text-align: center; margin-top:10px; margin-bottom:10px;\">\n<a href=[[~[[+id]]]]>\n<img src=\"[[+headerImage:phpthumbof=`w=640`]]\"class=\"logoResize\" border=\"0\"/>\n</a>\n</div>\n</td>\n</tr>"
            }]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 10555
              • 32 Posts
              Thanks Bruno,

              I will try that solution but the tpl is dynamic depending on which chunk is selected is there away I can add something [[$getnameofChunk]] that way it pulls the correct chunk each time.

              Thanks in advance.
                • 4172
                • 5,888 Posts
                does this work?

                ,"renderchunktpl":"[[$getnameofChunk]]" 
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 10555
                  • 32 Posts
                  Quote from: Bruno17 at Feb 11, 2014, 05:16 AM
                  does this work?

                  ,"renderchunktpl":"[[$getnameofChunk]]" 


                  It does not work.... why would it be simple. One question the dataindex points to the tv correct Is there anything else you would suggest or should I just create it using the Migx Configurator.
                    • 4172
                    • 5,888 Posts
                    ,"renderchunktpl":"[[$[[+nameOfChunk-field]]]]"


                    this should be a placeholder with a fieldname, which has the chunkname, of course.
                    Not sure, if this will work. Didn't test it, yet.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 10555
                      • 32 Posts
                      Quote from: Bruno17 at Feb 11, 2014, 05:35 PM
                      ,"renderchunktpl":"[[$[[+nameOfChunk-field]]]]"


                      this should be a placeholder with a fieldname, which has the chunkname, of course.
                      Not sure, if this will work. Didn't test it, yet.

                      [{
                          "formname":"GenericHeaderImage"
                          ,"formtabs":[{
                              "caption":"Generic Header"
                              ,"fields": [{
                                  "field":"headerImage"
                                  ,"caption":"Image"
                                  ,"inputTV":"GenericHeader"
                              }]
                         
                          }]
                      
                      },{
                          "formname":"FullHeaderImage"
                          ,"formtabs":[{
                                   "caption":"Full Image Header"
                                  ,"fields":[{
                      	     "field":"fullheaderImage"
                                  ,"caption":"Header Image"
                                  ,"inputTV":"CM-imageTV"
                              }]
                           }]
                      },{
                          "formname":"HorizontalLine"
                          ,"formtabs": [{ "caption":"Horizontal Line","fields": [{
                                  "field":"fake"
                                  ,"inputTV":"CM-hiddenTV"
                              },{
                                  "field":"cell_1_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"CM-hiddenTV"
                              },{
                                  "field":"cell_1_headline"
                                  ,"caption":"Horizontal Line"
                                  ,"inputTV":"CM-hiddenTV"
                              }]
                          }]
                      },{
                          "formname":"HorizontalSpace"
                          ,"formtabs":[{
                              "caption":"Horizontal Space"
                              ,"fields": [{
                                  "field":"fake"
                                  ,"inputTV":"CM-hiddenTV"
                              },{
                                  "field":"cell_2_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"CM-hiddenTV"
                              },{
                                  "field":"cell_2_headline"
                                  ,"caption":"HorizontalSpace"
                                  ,"inputTV":"CM-hiddenTV"
                              }]
                          }]
                      },{
                          "formname":"ImageGallery3column"
                          ,"formtabs":[{
                              "caption":"ImageGallery3column"
                              ,"fields": [{
                                  "field":"cell_1_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_1_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              },{
                                  "field":"cell_2_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_2_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              },{
                                  "field":"cell_3_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_3_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"TextFullWidthImage"
                          ,"formtabs":[{
                              "caption":"TextFullWidthImage"
                              ,"fields": [{
                                  "field":"cell_3_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_3_headline"
                                  ,"caption":"Headline"
                              },{
                                  "field":"cell_3_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"TextLeftAlignedImage"
                          ,"formtabs":[{
                              "caption":"TextLeftAlignedImage"
                              ,"fields": [{
                                  "field":"cell_4_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_4_headline"
                                  ,"caption":"Headline"
                              },{
                                  "field":"cell_4_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"TextOnly"
                          ,"formtabs":[{
                              "caption":"Text Only"
                              ,"fields": [{
                                   "field":"cell_5_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"Title"
                          ,"formtabs":[{
                              "caption":"Title Only"
                              ,"fields": [{
                                  "field":"title_headline"
                                  ,"caption":"Headline"
                                  },{
                                   "field":"link"
                                  ,"caption":"Link"   
                              }]
                         
                          }]
                      },{
                          "formname":"TextRightAlignedImage"
                          ,"formtabs":[{
                              "caption":"TextRightAlignedImage"
                              ,"fields": [{
                                  "field":"cell_6_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_6_headline"
                                  ,"caption":"Title"
                              },{
                                  "field":"link"
                                  ,"caption":"Link"
                              },{
                                  "field":"cell_6_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"LastWord"
                          ,"formtabs":[{
                              "caption":"Last Word"
                              ,"fields": [{
                                  "field":"lastword-desc"
                                  ,"caption":"Description"
                                  ,"inputTV":"richtextTV"
                              },{
                                  "field":"salutation"
                                  ,"caption":"salutation"
                              }]
                         
                          }]
                      },{
                          "formname":"TwoColumns"
                          ,"formtabs":[{
                              "caption":"TwoColumns"
                              ,"fields": [{
                                  "field":"cell_8_title"
                                  ,"caption":"Title"
                              },{
                                  "field":"cell_8_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              },{
                                  "field":"cell_9_title"
                                  ,"caption":"Title"
                              },{
                                  "field":"cell_9_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"TitleDescriptionFormatPricing"
                          ,"formtabs":[{
                              "caption":"TextLeftAlignedImage"
                              ,"fields": [{
                                  "field":"cell_7_image"
                                  ,"caption":"Image"
                                  ,"inputTV":"imageTV"
                              },{
                                  "field":"cell_7_title"
                                  ,"caption":"Title"
                              },{
                                  "field":"cell_7_link"
                                  ,"caption":"Link"
                              },{
                                  "field":"cell_7_subheadline"
                                  ,"caption":"Sub Title"
                              },{
                                  "field":"cell_7_format"
                                  ,"caption":"Format Availabilty"
                              },{
                                  "field":"cell_7_availabilty"
                                  ,"caption":"Availabilty"
                              },{
                                  "field":"cell_7_price"
                                  ,"caption":"Pricing"
                              },{
                                  "field":"cell_7_lastwords"
                                  ,"caption":"Last Words"
                              },{
                                  "field":"cell_7_content"
                                  ,"caption":"Content"
                                  ,"inputTV":"richtextTV"
                              }]
                         
                          }]
                      },{
                          "formname":"footerAB"
                          ,"formtabs":[{
                              "caption":"Alberta Footer"
                               ,"fields": [{
                                  "field":"fake"
                                  ,"inputTV":"CM-hiddenTV"
                              }]
                         
                      	}]
                      },
                      {
                          "formname":"footerON"
                          ,"formtabs":[{
                              "caption":"Ontario Footer"
                      		 ,"fields": [{
                                  "field":"fake"
                                  ,"inputTV":"CM-hiddenTV"
                              }]
                          }]
                      
                      },{
                          "formname":"footerBC"
                          ,"formtabs":[{
                                  "caption":"BC Footer"
                      			 ,"fields": [{
                                  "field":"fake"
                                  ,"inputTV":"CM-hiddenTV"
                              }]
                          }]
                         
                      }]


                      I probably should of included the above before...

                      Each form name has a corresponding chunk to it. @FIELD:MIGX_formname somehow use that as the renderChunktpl.