1. 使用loaderFilter函数过滤grid返回的json数据:
?grid能接受的json数据格式:?
{ "total":239, "rows":[ {"code":"001","name":"Name 1","addr":"Address 11","col4":"col4 data"}, {"code":"002","name":"Name 2","addr":"Address 13","col4":"col4 data"} ] }
?如果url返回的json格式不是如此,可使用loadFilter函数过滤,如返回如下数据:
?{"response": {
"total":239, "rows":[ {"code":"001","name":"Name 1","addr":"Address 11","col4":"col4 data"}, {"code":"002","name":"Name 2","addr":"Address 13","col4":"col4 data"} ] } }
? ?loaderFilter为:
loadFilter:function(data){ return data.response; }?