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
215
Support for nested properties as fields in grid
posted

Currently the data grid only works on flat data. Are there any plans to support nested objects?

E.g

{

name: 'My Name',

address: { street: '2 Street', county: 'Kent', postcode: 'AA1 2BB'}

}

You can't put the field as address.street or address.postcode as that is not supported.

Having to flatten all the data before giving it to the grid is quite problematic especially if you also want to be able to edit data and then send that back so you need to keep it in the original structure.

The alternative suggested is to use a cell template as you can then access the row data and the nested property. However, this then doesn't work for filtering or sorting the data.

Parents
  • 17590
    Offline posted

    Hello Katy,

    Thank you for posting in our community.

    You assumption is correct, at this point igx-grid`s main purpose is to handle flat data although this does not mean that it is impossible to work with more complex data.

    In this topic in our documentation complex data binding is explained step by step along with sample creation. The data format, that the sample uses looks like the following:

    export const EMPLOYEE_DATA = [
        {
            Age: 55,
            Employees: [
                {
                    Age: 43,
                    HireDate: new Date(2011, 6, 3),
                    ID: 3,
                    Name: "Michael Burke",
                    Title: "Senior Software Developer"
                },
                {
                    Age: 29,
                    HireDate: new Date(2009, 6, 19),
                    ID: 2,
                    Name: "Thomas Anderson",
                    Title: "Senior Software Developer"
                },
                .
                .
                .
                ]

    As you mentioned, this approach uses cell templating which works on the presentation layer, however, grid features manipulate the underlying data and they are not going to work as per your expectation.

    In case that you would like to see this feature implemented in any of our future releases my suggestion would be to submit a feature request in our GitHub repository here. This will give you the opportunity to directly communicate with our developers and receive notification whenever a new information regarding your request is available.

    Please have a look at the information provided and let me know if you need any further assistance with this matter.

Reply Children