3
我有一個jqGrid的一些記錄,並希望根據多個條件過濾記錄。在客戶端通過多個條件過濾jqGrid
例如,如果有三列,姓名,年齡和城市,我希望篩選在下述條件下電網:
Name = "Mark" and Age = 25 and City = 'NY'
下面的代碼工作細
var grid = jQuery("#memberDetails");
var postdata = grid.jqGrid('getGridParam', 'postData');
var filterArray = new Array();
var filterConidtion;
filterConidtion = new Object();
filterConidtion.field = "name";
filterConidtion.op = "eq";
filterConidtion.data = "Mark";
filterArray.push(filterConidtion);
filterConidtion = new Object();
filterConidtion.field = "Age";
filterConidtion.op = "eq";
filterConidtion.data = "25";
filterArray.push(filterConidtion);
filterConidtion = new Object();
filterConidtion.field = "City";
filterConidtion.op = "eq";
filterConidtion.data = "NY";
filterArray.push(filterConidtion);
jQuery.extend(postdata, {
filters: {
"groupOp": "and",
"rules": filterArray
}
});
grid.jqGrid('setGridParam', {
search: true,
postData: postdata
});
grid.trigger("reloadGrid", [{
page: 1
}]);
但我不知道如何使以下過濾器工作:
Name = "Mark" and Age = 25 and (City = 'NY' OR City = 'FL')
該groupOp
瓦特或者在AND或OR條件下,不知道如何在groupOp
內嵌入子條件
謝謝。