akveo / akveo/ng2-smart-table

Dropdown filter with a textbox than each column filter

Open
#926 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
867
PR merge metrics
No merged PRs in 30d

Description

Is it possible for each column filter to be combined into a dropdown select and a textbox?

So far from I see such as in issue [1827](https://github.com/akveo/ngx-admin/issues/1827#issue-351913374)
```

settings: {
columns: {
age: {
title: 'Age',
editor: {
type: 'list',
config: {
selectText: 'Select',
list: [
{value: '1', title:'Option 1'},
{value: '2', title:'Option 2'},
{value: '3', title:'Option 3'},
{value: '4', title:'Option 4'},
],
},
}
filter: {
type: 'list',
config: {
selectText: 'Select',
list: [
{value: '1', title:'Option 1'},
{value: '2', title:'Option 2'},
{value: '3', title:'Option 3'},
{value: '4', title:'Option 4'},
],
},
},
},
}
}
```
The filter would search for each column. But is it possible to combine all filter into a select and by then
got filtered by the textbox? Example:
![image](https://user-images.githubusercontent.com/17746819/50763333-181bfc80-12a2-11e9-92b9-0740b1e426a3.png)

Update:
For more clarification, I do manage to get the value from the custom dropdown into the textbox. But, problem is `setFilter` such as in [example](https://akveo.github.io/ng2-smart-table/#/examples/using-filters):

```
onSearch(query: string = '') {
this.source.setFilter([
// fields we want to include in the search
{
field: 'id',
search: query
},
{
field: 'name',
search: query
},
{
field: 'username',
search: query
},
{
field: 'email',
search: query
}
], false);
// second parameter specifying whether to perform 'AND' or 'OR' search
// (meaning all columns should contain search query or at least one)
// 'AND' by default, so changing to 'OR' by setting false here
}
```
was unable to be customized to only filter a field depending on selected value.

I've tried to use
```
{
field: value,
search: query
}
```
where value is the selected value but no avail.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.