esayui datagrid columns formatte 的问题

Java-我去 2017-08-16 05:43:29
esayui
 dg=$('#dg').datagrid({
method: "get",
url:ctx+' ,
pagination:true, //显示分页工具栏
rownumbers:true, //显示行号列
singleSelect:true,
fit:true,
columns:[[


{field:'message',title:'校验结果',width:100,formatter:function(value,row,index){

if(value == 0){
return '通过';
}
if(value == 1){
return '失败';
}

}},


{field:'reState',title:'sss',width:100,formatter:function(value,row,index){
alert(index)
if(value == 1){
return 'xxx';
}
if(parseInt(value) == 2){
return 'xxx';
}

}},

{field:'reState',title:'状态',width:100,formatter:formatterIsu(value,row,index){
if(value == 0){
return '未结清';
}
if(value == 1){
return '已结清';
}
if(value == 2){
return '账单核对失败';
}
if(value == 3){
return '结清中';
}
if(value == 4){
return '付款失败';
}

}},


]],
loadMsg:'嗖 ----正在火速加载中 -------------',
toolbar:'#tb'
});


json数据
{
"total":1,
"rows":[
{
"id":17,

"message":"0",
"reSerial":"200100000017447-1502866167622",
"reMode":1,
"reState":4,

}
]
}

message 这个数据 formatter:function
可以格式化
reMode reState 字段死活就没有反应不知怎么回事
...全文
188 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
学java不容易 2017-08-17
  • 打赏
  • 举报
回复
json数据

{
    "total":1,
    "rows":[
        {
            "id":17,
         
            "message":"0",
            "reSerial":"200100000017447-1502866167622",
             "reMode":1,
             "reModeName":"",
              "reState":4,
             "reStateName":""
        }
    ]
}
dg=$('#dg').datagrid({             method: "get",             url:ctx+' ,             pagination:true, //显示分页工具栏             rownumbers:true, //显示行号列             singleSelect:true,             fit:true,             columns:[[                             {field:'message',title:'校验结果',width:100,formatter:function(value,row,index){                       if(value == 0){                         return '通过';                     }                     if(value == 1){                         return '失败';                     }                   }},                      {field:'reModeName',title:'sss',width:100,formatter:function(value,row,index){                     alert(index)                     if(value ==  1){                         return 'xxx';                     }                     if(parseInt(value)  == 2){                         return 'xxx';                     }                   }},                    {field:'reStateName',title:'状态',width:100,formatter:formatterIsu(value,row,index){                     if(value == 0){                         return '未结清';                     }                     if(value == 1){                         return '已结清';                     }                     if(value == 2){                         return '账单核对失败';                     }                     if(value == 3){                         return '结清中';                     }                     if(value == 4){                         return '付款失败';                     }                   }},                        ]],             loadMsg:'嗖 ----正在火速加载中 -------------',             toolbar:'#tb'         });
Java-我去 2017-08-16
  • 打赏
  • 举报
回复
reMode reState 好像是int 的 就好像有问题,前台能把值显示出来就是 formatter 不起作用

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧