The requirements are as follows:
Realize the name, position, direct superior, user type four conditions fuzzy query, the results of the query to the page display.
Implementation logic:
Defines two arrays, where vm.nowalluserlists is the original data. Vm.nowalluserfilter is the filtered data. The final loop Vm.nowalluserfilter to render the table.
Before filtering, assign the value of Vm.nowalluserlists to Vm.nowalluserfilter, and the table renders all the data.
When filtering, initialize Vm.nowalluserfilter to an empty array and push the filtered contents into the array. The table renders the filtered data at this time.
Because it is not case-sensitive, you need to convert the filter criteria and the filtered data contents to uppercase toUpperCase.
The four filter conditions are the same as the relationship, then the && is connected.
The specific code is as follows:
If it is a single-condition query and a single-page query (without paging), there is an easier way. Most of the online circulation is also this, as follows:
$("table tbody tr").stop().hide() //将tbody中的tr都隐藏
.filter(":contains(‘"+($(this).val())+"‘)").show();//将查询到相关内容的tr显示
Using JS to implement table multi-conditional fuzzy query, which is compatible with paging