|
$(function () {
$("#Grid").ejGrid({
dataSource: Data,
allowPaging: true,
allowFiltering: true,
filterSettings:{ filteredColumns: [{ field: "OrderDate", operator: "greaterthanorequal", value: new Date('2017,11,14 00:00:00'), predicate: "and", matchCase: true },{ field: "OrderDate", operator: "lessthan", value: new Date('2017,11,15 00:00:00'), predicate: "and", matchCase: true }] } ,
columns: [
{ field: "OrderID", isPrimaryKey: true, headerText: "Order ID", textAlign: ej.TextAlign.Right, validationRules: { required: true, number: true }, width: 90 },
|
|
|
|
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<button type="button" onClick="refreshData()">FilterColumn</button>
<div id="Grid"></div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
allowFiltering: true,
filterSettings:{filterType:"excel"},
columns: [
---
]
});
});
function refreshData(args) {
var gridObj = $("#Grid").ejGrid('instance');
gridObj.model.filterSettings.filteredColumns = [{ field: "OrderID", operator: "equal", predicate: "or", value: "10248" }, { field: "OrderID", operator: "equal", predicate: "or", value: "10249" }];
gridObj.refreshContent();
}
</script>
|
|
var Data = [
{ OrderID: '10248', CustomerID: 'VINET', EmployeeID:'1', OrderDate: new Date("2017,11,14 00:00:00"), Employee:{Address:'India'},Freight:'33.38',ShipName:'Alfreds Futterkiste',ShipCountry:'Brazil'},
{ OrderID: '10249', CustomerID: 'TOMSP', EmployeeID:'2', OrderDate: new Date("2017,11,14 01:00:00"),Employee:{Address:'USA'},Freight:'11.61',ShipName:'Ana Trujillo Emparedados y helados',ShipCountry:'France'},
{ OrderID: '10250', CustomerID: 'HANAR', EmployeeID:'3', OrderDate: new Date("2017,11,14 02:00:00"),Employee:{Address:'UK'},Freight:'65.83',ShipName:'Antonio Moreno Taquería',ShipCountry:'Denmark'},
{ OrderID: '10255', CustomerID: 'ANTON', EmployeeID:'3', OrderDate: new Date("2017,11,15 00:00:00"), Employee:{Address:'USA'},Freight:'18.33',ShipName:'Hanari Carnes',ShipCountry:'Britain'},
{ OrderID: '10252', CustomerID: 'SUPRD', EmployeeID:'6', OrderDate: new Date("2017,11,13 00:00:00"), Employee:{Address:'Britain'},Freight:'58.17',ShipName:'Berglunds snabbköp',ShipCountry:'Austria'},
{ OrderID: '10253', CustomerID: 'WELLI', EmployeeID:'9', OrderDate: new Date("2017,11,14 23:59:59"), Employee:{Address:'Japan'},Freight:'58.17',ShipName:'Vins et alcools Chevalier',ShipCountry:'Mexico'},
.
.
.
];
$(function () {
$("#Grid").ejGrid({
dataSource: Data,
allowPaging: true,
|
|
gridObj.model.filterSettings.filteredColumns = [
{ field: "OrderDate", operator: "greaterthanorequal", predicate: "and", matchcase: true , value: startOfFilter },
{ field: "OrderDate", operator: "lessthan", predicate: "and", matchcase: true , value: endOfFilter }];
gridObj.refreshContent(); |