We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37108
    • 80 Posts
    I have a migx tv ("item-image" using a config named "keyimages") set up to build an image list for various css breakpoints. There is a second migx tv ("item-specials") that, among other fields, has an image field that uses the "keyimages" config as well. However I can only seem to get the first tv ("item-image") to use the specified custom media source, while the second always reverts to filesystem. Is this a limitation of migx or is there a special way of doing this? Thanks in advance for any advice!

    This question has been answered by multiple community members. See the first response.

      • 4172
      • 5,888 Posts
      can you show your MIGX-configurations, please?

      I'm better in reading and understanding code, than text.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 37108
        • 80 Posts
        Bruno - thanks for the quick response. As it turns out I do have it working. I'd played with a multitude of combinations in my configs, but only when I was reverting to where I thought I'd started (to send you the code) did I end up with the solution. I could swear I'd already tried it this way! Anyway, for those who might be struggling with a similar use case, the working code is posted below.

        FYI, I did the setup of these in the CMP (as opposed to directly in JSON). In the CMP in the field's Mediasource tab, both image tvs were set to config for the "source From" and a single entry in the "Sources" was set to Context: web, Source ID:2.

        The main image collection migx tv "keyimages" (empty values excluded here for brevity):
        {
          "formtabs":[
            {
              "MIGX_id":1,
              "caption":"Key Images",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":6,
                  "field":"image",
                  "caption":"Image",
                  "description_is_code":"0",
                  "inputTVtype":"image",
                  "sourceFrom":"config",
                  "sources":[
                    {
                      "MIGX_id":1,
                      "context":"web",
                      "sourceid":2
                    }
                  ],
                  "useDefaultIfEmpty":"0",
                  "pos":1
                },
               { ...ADDITIONAL FORM FIELDS EXCLUDED... }
              ],
              "pos":1
            }
          ],
          "contextmenus":"edit_migx||remove_migx",
          "extended":{
            "migx_add":"Add Image",
            "formcaption":"Key Image",
            "addNewItemAt":"bottom",
            "actionbuttonsperrow":4,
            "filtersperrow":4,
            "use_custom_prefix":"0",
            "gridload_mode":1,
            "check_resid":1,
            "has_jointable":"yes",
          },
          "columns":[
            {
              "MIGX_id":5,
              "header":"Image Thumbnail",
              "dataIndex":"image",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"this.renderImage",
              "clickaction":"selectFromGrid",
            },
            { ...ADDITIONAL COLUMNS EXCLUDED... }
          ]
        }
        


        And the second migx tv "specials" that makes use of the first one "keyimages" for its image field:

        {
          "formtabs":[
            {
              "MIGX_id":2,
              "caption":"Special",
              "print_before_tabs":"0",
              "fields":[
                { ... SOME FIELDS EXCLUDED ... },
                {
                  "MIGX_id":14,
                  "field":"special-image",
                  "caption":"Image",
                  "description":"Optional graphic specific to this special",
                  "description_is_code":"0",
                  "inputTVtype":"migx",
                  "configs":"keyimages",
                  "sourceFrom":"config",
                  "sources":[
                    {
                      "MIGX_id":1,
                      "context":"web",
                      "sourceid":2
                    }
                  ],
                  "useDefaultIfEmpty":"0",
                  "pos":5
                }
              ],
              "pos":1
            }
          ],
          "contextmenus":"edit_migx||duplicate_migx||remove_migx",
          "extended":{
            "migx_add":"Add Special",
            "formcaption":"Specials",
            "addNewItemAt":"bottom",
            "actionbuttonsperrow":4,
            "filtersperrow":4,
            "use_custom_prefix":"0",
            "gridload_mode":1,
            "check_resid":1,
            "has_jointable":"yes",
          },
          "columns":[
            { ... COLUMNS EXCLUDED... }
          ]
        }
        
          • 4172
          • 5,888 Posts
          great! I'm glad, you got it sorted.
          Thank's for coming back with your solution!
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 37108
            • 80 Posts
            Though the functional part of this is resolved I did detect a small problem: When specifying an image in the second migx tv, the keyimages grid fails to show the image thumbnail. Inspecting the source html, I see that the image phpthumb src path ends in "&source=1" where it should be "&source=2". Any clues as to why this might be happening?
            • discuss.answer
              • 4172
              • 5,888 Posts
              try adding also the mgr-context to the sources

                        "sources":[
                          {
                            "MIGX_id":1,
                            "context":"web",
                            "sourceid":2
                          },
                          {
                            "MIGX_id":2,
                            "context":"mgr",
                            "sourceid":2
                          }
                        ]
              
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 37108
                • 80 Posts
                OK, that takes care of it. I only needed to add the mgr source to the primary ("keyimages") tv to get the expected display in the second tv ("specials"), but added it to both for good measure. Thanks for the pointer, Bruno!