4
回答
easyUI 列表展示 formatter
开发十年,就只剩下这套Java开发体系了   

<table id="dg" class="easyui-datagrid" pageSize="20"
       toolbar="#toolbar" pagination="true" idField="openId"
       rownumbers="true" fitColumns="true" singleSelect="true"
       url="alipay_user/list.json">
    <thead>
    <tr>
     <th field="openId">支付宝id</th>
        <th field="name">用户名</th>
        <th field="alipayUser" formatter="managerName">姓名</th>
        <th field="alipayUser" formatter="managerInNum">身份证号</th>
        <th field="alipayUser.cardNum">社保卡号</th>
        <th field="createTime">注册时间</th>
        <th field="bizCode">所属业务点</th>
    </tr>
    </thead>
</table>

function managerName(val, row) {
 alert(0);
 if (val != null && val != "") {
  return row.alipayUser.name;
 } else {
  return "";
 }
}
 function managerInNum(val, row) {
 if (val != null && val != "") {
  alert(1);
  return row.alipayUser.inNum;
 } else {
  return "";
 }
}

结果没有执行managerInNum方法,而是执行了两次managerName方法

返回数据如下


{"success":true,"rows":[{"id":1,"name":"aaa","openId":"aaa","bizCode":"",
"alipayUser":{"id":1,"cardNum":"123456","inNum":"33376779238479234","name":"张三"},
"createTime":"2015-06-30 10:21:08"}],"total":1}

 

我想知道 怎么写才能正确显示列表数据

 

 

举报
顶部