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
335
Way to compose column data
posted

Sadly I haven't found a good solution for this. I don't want to map fields of the [data]-input 1:1 onto the grid, I want to compose 1 column out of several fields, basically an n:1 relation.

I want to connect several fields with a function, and the displaying the function result.

My first idea was creating my own object for this and filling it onInit, but I got the impression igx can't display static local data.

Right now my solution is somewhat ugly.

<igx-column width="200px" field="primaryKey" header="zb" dataType="number">
    <ng-template igxCell let-cell="cell">
        <span>{{get_zbValue(cell.value)}}</span>
    </ng-template>
</igx-column>

I take the id, and then use a function that uses it to get the data and compose the value I want. This seems horrible performance wise, even though I already have the data locally an ddon't need to pull it from a webservice.

Parents
  • 845
    Offline posted

    Hey Andreas,

    The grid columns do not support composite keys out of the box but you can still create a column out of several other columns.

    Inside the cell template context the `cell` object itself has a reference to the row and the row data itself so you can access any field inside your data model object. You can also use the row data itself and pass it to a method/pipe in your case.

    I've prepared a sample with 2 grids, one bound to a array of flat objects and one bound to a more nested version of the objects where the User Details column is composed out of 3 different data fields. Feel free to explore the sample and ask for any additional clarification here.

Reply Children
No Data