You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using LocalDataSource.setFilter() with andOperator === false AND with those columns' filter text box displaying; the andOperator is always overridden to be true.
Example: once your data is loaded, you would like to set the filter to show those records where either of two column searches is found; i.e.: this.dataList.setFilter([{ field: "fieldA", search: "test"}, { field: "fieldB", search: "test"}], false);
You also have table settings as follows: ...columns: { fieldA: { title: "Field A", filter: true}, fieldB: { title: "Field B", filter: true} }
You can monitor the change updates via: this.projects.onChanged().subscribe(async (change) => { if (change.action === "filter") { ... }
The change.filter.andOperator first comes into the above anonymous function as false and then true. This defeats the original andOperator === false.
With further research, I found ng2-smart-table calls FormsControl.setValue as: this.inputControl.setValue(this.query);
...and this triggers an onChange event on the filtering text input control. This causes the second unexpected on-change event on the LocalDataSource with the andOperator set to true.
Normally, when a user manually updates the filter fields, it is expected that the filters would be AND'd together. But in this case, I am trying to filter on either fields by trying to OR the field searched together.
The text was updated successfully, but these errors were encountered:
richardruge
changed the title
Using LocalDataSource setFilter with andOperator == false
Using LocalDataSource setFilter with andOperator === false
Feb 25, 2020
Using LocalDataSource.setFilter() with andOperator === false AND with those columns' filter text box displaying; the andOperator is always overridden to be true.
Example: once your data is loaded, you would like to set the filter to show those records where either of two column searches is found; i.e.:
this.dataList.setFilter([{ field: "fieldA", search: "test"}, { field: "fieldB", search: "test"}], false);
You also have table settings as follows:
...columns: { fieldA: { title: "Field A", filter: true}, fieldB: { title: "Field B", filter: true} }
You can monitor the change updates via:
this.projects.onChanged().subscribe(async (change) => { if (change.action === "filter") { ... }
The change.filter.andOperator first comes into the above anonymous function as false and then true. This defeats the original andOperator === false.
With further research, I found ng2-smart-table calls FormsControl.setValue as:
this.inputControl.setValue(this.query);
...and this triggers an onChange event on the filtering text input control. This causes the second unexpected on-change event on the LocalDataSource with the andOperator set to true.
Normally, when a user manually updates the filter fields, it is expected that the filters would be AND'd together. But in this case, I am trying to filter on either fields by trying to OR the field searched together.
The text was updated successfully, but these errors were encountered: