问题
My title pretty much says it all. I want to run a full text search (simply contains or like search) against every column and row in an ag-grid. Is this possible? This is built into datatables.
回答1:
Yes, It is possible. Please refer to https://www.ag-grid.com/javascript-grid-filter-quick/
<input type="text" id="filter-text-box" placeholder="Filter..." oninput="onFilterTextBoxChanged()"/>
function onFilterTextBoxChanged() {
gridOptions.api.setQuickFilter(document.getElementById('filter-text-box').value);
}
回答2:
Ag-grid Doc - https://www.ag-grid.com/javascript-grid-filter-quick/#quick-filter-example
Plunker - https://plnkr.co/edit/NaDAQYvXoo2P6vxdvPVB?p=preview
Add a text box with function onFilterTextBoxChanged()
<input type="text" id="filter-text-box" placeholder="Filter..." oninput="onFilterTextBoxChanged()"/>
setQuickFilter for Ag-grid with the value entered by the user in this text box
function onFilterTextBoxChanged() {
gridOptions.api.setQuickFilter(document.getElementById('filter-text-box').value);
}
回答3:
Not natively, but you can implement you own external Filter
Check section External Filtering here https://www.ag-grid.com/angular-grid-filtering/index.php.
来源:https://stackoverflow.com/questions/35854791/is-there-any-way-to-run-a-search-against-all-columns-and-rows-in-the-grid-in-ag