Shantanu Gupta
Shantanu Gupta

Reputation: 21188

How to filter array inside ag-grid for a column definition

I am changing my grid from dataTable to ag-grid. When using DataTable, I was taking first element from attributes array where typeName='ItemType'. I want to implement the same functionality using ag-grid. How an achieve the same.

<tr ng-repeat="e in entities">
    <td>
        <span ng-repeat="c in e.attributes | filter:{typeName:'ItemType'}:true">
                                                            {{c.configValue}}
        </span>
    </td>
</tr>

In ag-grid syntax, i have to display same value as I used in dataTable.

var columnDefs = [
   { headerName: "Type", field: "attributes", width: 150},//ItemType
   { headerName: "Brand", field: "attributes", width: 150 }//Brand
];

Upvotes: 0

Views: 3973

Answers (1)

Walfrat
Walfrat

Reputation: 5353

You can use cell Render to customise the rendering or your cell.

Moreover there is a option angularCompileRows to compile the template that you return from the cellRender function.

Check : http://ag-grid.com/javascript-grid-properties/index.php for properties and http://ag-grid.com/angular-grid-cell-rendering/index.php for cellRendering

Upvotes: 1

Related Questions