Search code examples
dhtmlx

Setting mapping DHTMLX


Is there a way to have attribute mapping in DHTMLX tree grid as we have in gantt charts? For example if we have set for a column id ="Age", it should look for that attribute in the incoming JSON data and automatically map it to appropriate column.


Solution

  • You can use setColumnIds command

    mygrid.setColumnIds("sales,book");
    

    And use column ids for data mapping

    mygrid.parse([
        { id:1, sales:"1220", book:"The BestSeller"}
    ], "js")
    

    and for loading from the external source

    mygrid.load("data.php", "js")
    

    The key point here is the usage of "js" as data loading type.