We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51867
    • 19 Posts
    Hi

    I need to display the date in my MigX table, but not the time. I have created a TV that hides the date selector from the user, but it still displays the time whenever I add a new entry in the MigX table. I am trying to list release dates for record releases, so the time down to the second is not really very useful.

    I have scoured the internet looking for a solution, but everything is either way out of date, or total gibberish to me.

    Anyone got any ideas? I have attached a couple of screen shots just to highlight the problem (although its fairly self explanatory).

    Andy
      • 4172
      • 5,888 Posts
      if don't want to see the time in the grid, you could create a new column and use the renderchunk-renderer to render only the date.
      Be sure, that you don't use the fieldname of your date-field for the fieldname of that column. That column is only used to render the formated date in the grid, then.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 51867
        • 19 Posts
        Hi Bruno

        Thanks for the quick reply.

        I have not used the MigX configurator to create the MigX object, but have instead used the input options and raw JSON. Is there a way to do this still?

        Also, is there any documentation on using the configurator? I can't find anything online that guides people through the process.

        Andy
          • 51867
          • 19 Posts
          Hi Bruno

          Thanks for the quick reply.

          I have not used the MigX configurator to create the MigX object, but have instead used the input options and raw JSON. Is there a way to do this still?

          Also, is there any documentation on using the configurator? I can't find anything online that guides people through the process.

          Andy
            • 4172
            • 5,888 Posts
            its also possible with the json-config in columns, but it is easier with the configurator

            you would create a new config, give it a name (and a unique MIGX-id,which can be the same like the name)
            then create your formtabs and columns, everthing else is not needed.

            for you renderdate-column, select the renderChunk-renderer and put something like that into the renderTpl-field:

            [[+date:strtotime:date=`%d.%m.%Y`]]


            then instead the formtabs and columns - json, put the name of that config into the 'configs' - field of the TV

            you can also import your existing formtabs and columns with 'edit raw' your configuration.
            Another way is to create your columns with the configurator.
            Do 'edit raw' copy the generated json of the columns and paste it into the 'columns' - field of your TV.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 51867
              • 19 Posts
              Hi Bruno

              I have tried as you said, but now it just has a 'Load Grid' button, that then loads an empty grid?

              I pasted in the JSON into the edit raw sections as suggested. Also, even though I have given my migx item a unique ID it has a number instead of the ID name, and only loads the 'Load Grid' thing when I enter the number, not the name. Please see the screen shots as an example of what I mean.

              Andy
                • 51867
                • 19 Posts
                Ok, I have tried it the other way round (getting the raw JSON from the configurator and putting it into the TV) and it is working now, but the date is still showing wrong. Here are my form tabs:

                [{"MIGX_id":5,"caption":"Release","print_before_tabs":"1","fields":[{"field":"ReleaseTitle","caption":"Release Title","inputTVtype":"text","pos":1,"MIGX_id":5},{"field":"ReleaseType","caption":"Release Type","inputTVtype":"listbox","inputOptionValues":"LP==LP || EP==EP || Split==SPLIT || Single==SINGLE","pos":2,"MIGX_id":6},{"field":"ReleaseArt","caption":"Release Artwork","inputTVtype":"image","pos":3,"MIGX_id":7},{"field":"ReleaseDate","caption":"Release Date","inputTV":"OnlyDate","pos":4,"MIGX_id":8},{"field":"DigitalPurchaseLink","caption":"Digital Purchase Link","inputTVtype":"text","pos":5,"MIGX_id":9},{"field":"PhysicalPurchaseLink","caption":"Physical Purchase Link","inputTVtype":"text","pos":6,"MIGX_id":10}],"pos":1}]

                and here is my Grid Columns:

                [{"header":"Release Title","width":"70","sortable":"true","dataIndex":"ReleaseTitle","MIGX_id":1},{"header":"Release Cover","width":"50","sortable":"false","dataIndex":"ReleaseArt","renderer":"this.renderImage","MIGX_id":2},{"MIGX_id":"3","header":"Release Date","dataIndex":"ReleaseDate","width":"70","sortable":"true","show_in_grid":"1","customrenderer":"","renderer":"this.renderChunk","clickaction":"","selectorconfig":"","renderchunktpl":"[[+date:strtotime:date=`%d.%m.%Y`]]","renderoptions":"","editor":""}]

                The OnlyDate TV is a modx date tv with the 'hide time from users' option selected, and the output set as default.

                Any help would be greatly appreciated.

                Andy
                  • 4172
                  • 5,888 Posts
                  sounds, like you have selected the migxdb - TV-type, when you get the 'Load Grid' - button?

                  As I said before, the column, where you are using the renderChunk - renderer has to have a different fieldname.
                  And you need to change the placeholder to your fieldname.

                  Try:

                  [{"header":"Release Title","width":"70","sortable":"true","dataIndex":"ReleaseTitle","MIGX_id":1},
                  {"header":"Release Cover","width":"50","sortable":"false","dataIndex":"ReleaseArt","renderer":"this.renderImage","MIGX_id":2},
                  {"MIGX_id":"3","header":"Release Date","dataIndex":"renderMyDate","width":"70","sortable":"true","show_in_grid":"1","customrenderer":"","renderer":"this.renderChunk","clickaction":"","selectorconfig":"","renderchunktpl":"[[+ReleaseDate:strtotime:date=`%d.%m.%Y`]]","renderoptions":"","editor":""}]
                  
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 51867
                    • 19 Posts
                    Hi Bruno

                    I had selected the Migxdb tv type when it came up with the Load Grid option. As I couldnt get that to work I decided to stick with using a MigX standard TV type and work with the raw JSON instead for this one, at least so I could learn what was going on hopefully.

                    I have added the suggested code, and now it is outputting nothing at all?

                    Here is the code I have now got in the grid columns section:

                    
                    [{"header":"Release Title","width":"70","sortable":"true","dataIndex":"ReleaseTitle","MIGX_id":1},{"header":"Release Cover","width":"50","sortable":"false","dataIndex":"ReleaseArt","renderer":"this.renderImage","MIGX_id":2},
                    
                    {"MIGX_id":"3","header":"Release Date","dataIndex":"renderMyDate","width":"70","sortable":"true","show_in_grid":"1","renderer":"this.renderChunk","renderchunktpl":"[[+ReleaseDate:strtotime:date=`%d.%m.%Y`]]"}]
                    
                    


                    It is just showing a blank space instead of the date and time now. I really can't see what I am doing wrong, and I apologise for this being so painfully slow. I am desperate to get this to work if I can.

                    Andy
                      • 4172
                      • 5,888 Posts
                      what happens without the output-filter:

                      "renderchunktpl":"[[+ReleaseDate]]"


                      ReleaseDate is the field of your date, right?
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!