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

    Product has some config options, each option is caption+description, I wanna use custom MIGX TV grid field for that. This is working perfect for the website frontend with help of getImageList but there is some render issue while adding raw HTML into row cell. Please check, firstly I add new row and put there some text:
    http://take.ms/fQaov , press "Выполнить" and can see the correct grid: http://take.ms/PHAe3
    After that I save the page and reload it, open corresponding TV tab and there is no Description column at all(((
    http://take.ms/V2ls0

    How can I fix that? What can I do for proper raw HTML rendering? I've checked current renders list within core/components/migx/configs/grid/grid.renderer.inc.php but didn't find anything that helped me. Should I write some custom renderer for such HTML data?

    Form Tabs:
    [
    {"caption":"Tabs", "fields": [
    {"field":"PConfigTitle","caption":"Title","inputTVtype":"text"},
    {"field":"PConfigDescription","caption":"Description","inputTVtype":"textarea"}
    ]}]


    Grid Columns:
    [
    {"header": "Title", "width": "100", "sortable": "true", "dataIndex": "PConfigTitle"},
    {"header": "Description", "sortable": "false", "dataIndex": "PConfigDescription","width": "400"}
    ]


    Many thanks,
    Anton

    UPDATE:

    I've found some helpful article
    https://www.studiorepublic.com/blog/modx-tutorial:-custom-renderers-for-migx-columns.html

    and tried use the custom renderer like the next:

    $wrap_code = '<code>{0}</code>';
    $renderer['this.rendererWrapHTML'] = "
    rendererWrapHTML : function(val, md, rec, row, col, s) {
     return String.format('{$wrap_code}', val);
    }
    ";

    And it works, but ONLY after adding new item/updating current row unfortunately. Initial load returns the same broken grid. Please give some hint how apply custom renderer exactly before first grid rendering.

    Thanks!
    [ed. note: himurovi4 last edited this post 11 years, 1 month ago.]
      Anton Tarasov
      MODX Developer

      Email: [email protected]
      Web: antontarasov.com