Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
igHierarchicalGrid
posted

Hi,

I have this code to a igHierarchicalGrid

            $("#hierarchicalGrid").igHierarchicalGrid({
                width: "100%",
                dataSource: data, //Array of objects defined above
                columns: [
                                { key: "Name", headerText: "Name IX", dataType: "string", width: "30%" },
                                { key: "SubName", headerText: "Sub Name IX", dataType: "string", width: "70%" }
                ],
                columnLayouts: [
                    {key: "Products",
                        responseDataKey: "",
                        width: "100%",
                        autoGenerateColumns: false,
                        columns: [
                            { key: "Name", headerText: "Nome", dataType: "string", width: "50%" }
                        ]
                    }],
                autoGenerateLayouts: true
            });



If i declare data this way:

               var data = [
                {
                    Name: "Food",
                    SubName: "SubFood",
                    Products: [
                        { Name: "Bread" },
                        { Name: "Pizza" }
                    ]
                },
                {
                    Name: "Beverages",
                    SubName: "SubBeverages",
                    Products: [
                        { Name: "Milk" },
                        { Name: "Fruit punch" }
                    ]
                }
            ];


It works fine, but if a declare data this way:


   data = [
                                   ["Food1112w", "SubFood", ["Bread1", "Bread1"]],
                                   ["Beverages", "SubBeverages", ["Milk1", "Milk2"]]
                                ];


Just works fine the top rows, but not show the details...


I want to send data this way to save lots of traffic in server... It works fine with igGrids to... Is it possibe to send data this way working with HierarchcalGrids?


Thanks in Advance,

Miguel Oliveira

Parents
No Data
Reply
  • 49378
    posted

    Hello Miguel,

    It is not possible to bind the child levels to an array of arrays as there is no way to match the layout with the respective nested array (there could be multiple child layouts at the same level for instance). In addition to that, while the grid is displaying the records for the root level, the way this is done is just setting the value by the index of the item in the array, therefore in this case if the SubName column were defined before the Name one, it would get assigned the values for the Name column.

     

Children