<button id="btn" onclick="Filter()">
Click here to filter
</button>
…………………..
<div id="Grid"></div>
<script type="text/javascript">
$(function () {
………………………
$("#Grid").ejGrid({
………………………………..
allowFiltering: true,
filterSettings: { filterType: "excel" },
columns: [
……………………………………………..
]
});
});
function Filter() {
var gridObj = $("#Grid").ejGrid("instance"); // create the grid instance using grid ID.
gridObj.filterColumn([
{ field: "CustomerID", operator: "contains", value: 'o', predicate: "and", matchcase: false },
{ field: "CustomerID", operator: "contains", value: 'u', predicate: "and", matchcase: false },
])
}
…………………………..
</script>
</body>
</html> |