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
960
JSON object with subobject as datasource for igGrid
posted

I have an igGrid that I want to use a JSON object as the datasource. The object is built from a DB call in an AJAX request from a 'relationship' table and the object associated to it. The relationship table has the parent ID, the type of relationship and the child ID, with all the child details in a child table based on child ID. The data is queried as a Hibernate join between these tables based on the parent ID, so the Java object returned looks like this.

class children {

    int parentID;

    int childID;

    String type;

    Child child;

}

The subsequent JSON object models this list of children as an array of these 'relationships' with the child being a sub-object within each 'row', exactly how it should. My problem is that I can't get the subobject values to appear in my grid. I have it defined like this :

                { headerText: "Type",        key: "type",              dataType: "string" },
                { headerText: "Name",       key: "child.name",    dataType: "string" },

The 'type' field shows up in the grid, but the 'child.name' field does not. I can access the child data fine in javascript exactly how I'd expect, but the grid stays blank.

What am I doing wrong? Thanks in advance...

Parents Reply Children
No Data