Some users might want to have 1 main single search for filtering the grid data instead of using multiple column filters. You can see a demo of that below.
Note the code below came from a different SlickGrid framework, just change the .bind to whatever framework you use with the appropriate code change. It's only meant to show roughly how to do it.
Code Sample
View
<formclass="form-inline"> <divclass="form-group"> <label> Single Search:<br> </label> <selectvalue.bind="selectedColumn"class="form-control"> <optionrepeat.for="column of columnDefinitions"model.bind="column"> ${column.name} </option> </select> </div> <selectvalue.bind="selectedOperator"class="form-control"> <optionrepeat.for="operator of operatorList"model.bind="operator"> ${operator} </option> </select> <inputtype="text"class="form-control"placeholder="search value"value.bind="searchValue"> </form><divgrid-id="grid21"column-definitions.bind="columnDefinitions"grid-options.bind="gridOptions"dataset.bind="dataset"></div>
ViewModel
exportclassMyExample { selectedColumn:Column; selectedOperator:string; searchValue:string; grid:SlickGrid; dataView:SlickDataView; columnDefinitions:Column[]; gridOptions:GridOption; dataset:any[]; operatorList:OperatorString[] = ['=','<','<=','>','>=','<>'];//// -- if any of the Search form input changes, we'll call the updateFilter() method//selectedOperatorChanged() {this.updateFilter(); }selectedColumnChanged() {this.updateFilter(); }searchValueChanged() {this.updateFilter(); }updateFilter() {constfieldName=this.selectedColumn.field;constfilter= {};constfilterArg:FilterCallbackArg= { columnDef:this.selectedColumn, operator:this.selectedOperator asOperatorString,// or fix one yourself like '=' searchTerms: [this.searchValue ||''] };if (this.searchValue) { // pass a columnFilter object as an object which it's property name must be a column field name (e.g.: 'duration': {...} )
filter[fieldName] = filterArg; }this.sgb.dataView.setFilterArgs({ columnFilters: filter, grid:this.aureliaGrid.slickGrid });this.aureliaGrid.dataView.refresh(); }