On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • chris@studiorepublic.com Reply #1, 7 years, 11 months ago
    Hi,

    I'm trying to use this.Renderdate with a MIGX tv. I've set manager_date_format to d-m-Y but this isn't having an effect. I have 2.2.3 installed and the code is there in grid.config.inc.php:

    $renderer['this.renderDate'] = "
    renderDate : function(val, md, rec, row, col, s) {
        var date;
        date = Date.parseDate(val, 'Y-m-d H:i: s');
        return String.format('{0}', date.format(MODx.config.manager_date_format+' '+MODx.config.manager_time_format));
    }
    ";


    My grid is defined as:

    [
    {"header": "Week", "width": "50", "sortable": "false", "dataIndex": "week"},
    {"header": "Price", "width": "350", "sortable": "false", "dataIndex": "price"},
    {"header": "Begins", "width": "150", "sortable": "false", "dataIndex": "begins", "renderer": "this.renderDate"},
    {"header": "Ends", "width": "150", "sortable": "false", "dataIndex": "ends", "renderer": "this.renderDate"},
    {"header": "Sold", "width": "50", "sortable": "false", "dataIndex": "sold"}
    ]


    Any ideas on why it's not working?
      Studio Republic
      http://www.studiorepublic.com
      0845 226 3205
      @christodhunter
    • custom-renderers didn't work in a normal MIGX-grid, only in the default MIGXdb-grid

      with this fix it should now:
      https://github.com/Bruno17/MIGX/commit/5d91ea7f9c27d4f5e448eb5342d6498f2edace11
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • chris@studiorepublic.com Reply #3, 7 years, 10 months ago
        Bruno - you're a legend! Thanks for your help - working perfectly now smiley
          Studio Republic
          http://www.studiorepublic.com
          0845 226 3205
          @christodhunter