Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions packages/oui-datagrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,67 @@ You can use `row-loader`. It take the current row as argument and must return a
</oui-datagrid>
```

### Filtering using dynamic column

```html:preview
<oui-datagrid
rows="$ctrl.servers"
page-size="5"
columns="[{
title: 'Name',
property: 'name',
sortable: 'asc',
searchable: true,
filterable: true,
type: 'string',
typeOptions: {
operators: [
'contains'
]
}
},
{
title: 'CPUs',
property: 'cpu',
sortable: true,
searchable: true,
filterable: true,
type: 'number'
},
{
title: 'Running',
property: 'up',
sortable: true,
filterable: true,
type: 'boolean'
},
{
title: 'Purpose',
property: 'purpose',
sortable: true,
filterable: true,
type: 'options',
typeOptions: {
values: {
network: 'Network',
database: 'Database',
static: 'Static content',
frontend: 'Frontend',
backend: 'Backend',
broker: 'Broker',
others: 'Others'
}
}
},
{
title: 'IP',
property: 'ip',
sortable: true,
filterable: true,
type: 'string'
}]"></oui-datagrid>
```

### Refresh

#### Local datagrid
Expand Down
7 changes: 4 additions & 3 deletions packages/oui-datagrid/src/datagrid-column-builder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class DatagridColumnBuilder {
};
}

buildFromJs (columnsDescription, $scope) {
buildFromJs (columnsDescription) {
const columns = [];
const currentSorting = {
columnName: undefined,
Expand Down Expand Up @@ -132,8 +132,9 @@ export default class DatagridColumnBuilder {
column.searchable = DatagridColumnBuilder.isSearchable(column) &&
columnDescription.searchable;

if (column.typeOptions) {
column.typeOptions = this.$parse(column.typeOptions)($scope);

if (columnDescription.typeOptions) {
column.typeOptions = columnDescription.typeOptions;
}

column.preventCustomization = columnDescription.preventCustomization;
Expand Down