kendo ui 使用问题记录

filed中使用日期格式化无效

需要指定该字段的类型,在DataSource 在进行数据类型指定

schema: {
                data: 'rows',
                total: 'total',
                model: {
                    id: "taskPaymentId",
                    fields: {
                        docDate:{type:"date"}
                    }
                }
            }

在column的字段中再使用format: “{0: yyyy-MM-dd}”

在Grid中使用了过滤,想把过滤条件传到服务器端

在dataSource 中添加参数:

serverFiltering: true

在transport 的parameterMap 中接收过滤条件


transport: {
read: {
url: BaseUrl + "query",
type: "POST",
dataType: "json"
},
parameterMap : function(options, type) {
if (type === "read") {
//判断是否有过滤条件
if(options.filter){
for (var i = 0; i < options.filter.filters.length; i++) {
if (options.filter.filters[i].field == 'docDate') {
var date = new Date(options.filter.filters[i].value);
var p = kendo.toString(date, "yyyy-MM-dd HH:mm:ss");
options.filter.filters[i].value = p;
}
viewModel.model.set(options.filter.filters[i].field,options.filter.filters[i].value);
}
}
datas = viewModel.model.toJSON();
return datas;
}
}
}

猜你喜欢

转载自blog.csdn.net/ftdd_hw/article/details/79312874