|
发表于 2016-9-8 20:21:34
|
显示全部楼层
可参考外卖例子的代码:
// 订单列表过滤
Model.prototype.filterBtnClick = function(event) {
var startDate = this.getElementByXid('startDate').value;
var endDate = this.getElementByXid('endDate').value;
var userName = this.getElementByXid('userName').value;
var dispatchingState = this.getElementByXid('dispatchingState').value;
var data = this.comp('cuisineOrderData');
if (startDate != "" && endDate != "") {
data.setFilter("filter1", "takeout_order.fCreateTime between :startDate and :endDate");
data.filters.setVar("startDate", startDate);
data.filters.setVar("endDate", endDate);
}
if (userName != null && userName != "") {
data.setFilter("filter2", "takeout_order.fUserName like '%" + userName + "%'");
}
if (dispatchingState != null && dispatchingState != "") {
data.setFilter("filter3", "takeout_order.fDispatchingState = :dispatchingState");
data.filters.setVar("dispatchingState", dispatchingState);
}
this.comp('cuisineOrderData').refreshData();
};
|
|