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
    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'

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

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 42838
      • 28 Posts
      MIGX-configurator-CMP retur error "quip.thread_err_save". What it may be, i don't know
        • 4172
        • 5,888 Posts
        may be, the configuration-table 'modx-migx-configs' isn't created.

        go to the tab 'Package Manager'
        in 'package name' put in: 'migx'
        Then go to the tab 'create tables'
        And click the button 'Create tables'

        Is it working then?

        btw.: with which version of MIGX are you working?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 42838
          • 28 Posts
          "Create table" returned success, but returns an error creating configuration
            I'm using version 2.5.9
            • 4172
            • 5,888 Posts
            this processors in the package-manager do allways return 'success'.
            there is currently no check, if the table really was created.

            is the table there, in the db?

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

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 46006
              • 17 Posts
              Use 'renderSnippet' in MIGX (not MIGXdb)

              MIGX is a great plugin. I use it all the time - but a few days ago I needed to output my 'grid column' data slightly differently (e.g. take an 'id', retrieve the 'name' associated with that 'id' from the database and display it). After lots and lots of searching (and I mean a lot!) I thought I could simply use the 'renderChunk' option in my MIGX configuration json. Unfortunately documentation on this is poor, and it turns out, you cannot use 'renderChunk' on the basic MIGX tvs.

              So... I've adapted the plugin to allow for this. I've created a custom renderer called 'renderSnippet' - but if you want to call a 'chunk', you can just include it your 'snippet' as you normally would.

              This is my step-by-step guide to implementing 'renderSnippet' for regular MIGX (not MIGXdb).

              Step 1
              Edit this file:
              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'];
              }

              Step 2
              Edit this file:
              core/components/migx/configs/grid/grid.config.inc.php

              Add the following code anywhere in this file:

              $renderer['this.renderSnippet'] = "
              renderSnippet : function(val, md, rec, row, col, s) {
              var column = this.getColumnModel().getColumnAt(col);
              MODx.Ajax.request({
              url: MODx.config.base_url+'/core/components/migx/processors/mgr/migx/customrenderers.php'
              ,params: {
              type : 'snippet',
              name : column.rendereroptions.name,
              options : column.rendereroptions.options,
              col : col,
              row: row,
              val: val
              }
              ,listeners: {
              'success': {fn:function(res){
              $('.x-grid3-cell-inner.x-grid3-col-'+res.data.col+':eq('+res.data.row+')').html(res.data.display);
              }
              }
              }
              });
              return;
              }
              ";

              Step 3
              Place the attached file into the following folder in your MODX site's directory:

              core/components/migx/processors/mgr/migx/customrenderers.php

              Step 4
              Create a snippet to use with MIGX in the usual way. An example is attached. This 'renderSnippet' will allow you to pass the following values to your snippet:

              1. 'val' - this is the value shown in your grid column (e.g. after dataIndex has been process by MIGX)
              2. 'options' - this allows you to send multiple params to your snippet (e.g. firstname=Henry&lastname=Jones)

              Step 5
              Create your MIGX tv as you normally would. An example file is attached. Notice how you call the 'renderSnippet' in the 'name' field and specify the 'options':

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

              Happy coding.

              Jim



              [ed. note: jimf3000 last edited this post 10 years, 4 months ago.]
                • 46006
                • 17 Posts
                It's my first time posting here... not sure whether or not the files I attached are visible to forum users. If not, just reply to the post and I'll try uploading them again.
                  • 46006
                  • 17 Posts
                  Here are the files:

                  1. customrenderers.php
                  2. example.migx.txt
                  3. example.snippet.php
                    • 4172
                    • 5,888 Posts
                    @jimf3000:
                    It should be possible, just to place your snippet-tag
                    [[yoursnippet]]
                    into the MIGX-configurator 'renderChunk template' textarea and use the renderChunk-renderer.

                    This will run your snippet.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 46006
                      • 17 Posts
                      Hi Bruno,

                      Thanks for your reply. Can you be more specific with where the 'snippet-tag' needs to go? For example, does this need to go in the 'Form Tabs' or 'Grid Column' json (in the MIGX tv) or somewhere else?

                      As I indicated in my original post, I am not using MIGXdb, I simply have a MIGX tv with a couple of fields.

                      Before writing the additional plugin code, I did try everything... but couldn't get it to work.