akveo / akveo/ng2-smart-table

Dropdown filter with a textbox than each column filter

未关闭
#926 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
1.6k
派生
867
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。