Permalink
Browse files

feat(datatable): Add searchable for each columns on table

This is about adding one option which is called `searchable` for each column on datatable. I have updated document as well.
  • Loading branch information...
nvtin committed Jan 22, 2018
1 parent 96abbb6 commit 6b4d830f1d06eab179732c225af5fb732a8d31ec
Showing with 10 additions and 2 deletions.
  1. +7 −0 doc/usage.md
  2. +1 −1 src/columns-filter.js
  3. +2 −1 src/datatable.js
@@ -60,10 +60,17 @@ export class List {
route : {
name : 'groups', // The name of your route in your application
params: {group: 'id'} // Optional. Paramaters required for the given route. ({name: 'value'})
},
{
property: 'created_at',
label: 'created_at',
searchable: false
}
}];
}
```
By default, searchable for each column will be set `true`. If you dont want to search on that column, let set `searchable` to `false`.
This is used for table content, but also the table headers. There's support for nested objects, as well as aliases. Example:
#### Simple
@@ -1,5 +1,5 @@
export class ColumnsFilterValueConverter {
toView(array) {
return array.filter(item => item.column.indexOf('.') === -1);
return array.filter(item => item.column.indexOf('.') === -1 && item.searchable);
}
}
@@ -301,7 +301,8 @@ export class DataTable {
column : column.property,
label : ucfirst(clean(column.label || column.property)),
route : column.route || false,
converter: column.valueConverters || false
converter: column.valueConverters || false,
searchable: typeof column.searchable === 'boolean' ? column.searchable : true
};
});
}

0 comments on commit 6b4d830

Please sign in to comment.