一只会飞的白菜 2017-09-05 05:57 采纳率: 0%
浏览 728
已采纳

thead 如果数据是1,就为男生

   <table id="dg" title="用户信息"
            toolbar="#toolbar" pagination="true" idField="id"
            rownumbers="true" fitColumns="true" singleSelect="true">
        <thead>
            <tr>
                <th field="uid" width="100">编号</th>
                <th field="uname" width="100" editor="{type:'validatebox',options:{required:true}}">名字</th>
                <th field="ucard" width="100" editor="{type:'validatebox',options:{required:true}}">身份证</th>
                <th field="ugender" width="100" editor="{type:'validatebox',options:{required:true}}",sortable:true,formatter:function(value,row,index){
                        console.log(value);
                        console.log(row.ugende);
                       if(row.ugende==1){
                         return '男';
                       }else if(row.ugende==2){
                        return '女';
                       }}>性别</th>
                <th field="uphone" width="100" editor="{type:'validatebox',options:{required:true}}">电话</th>
                <th field="ucount" width="100" editor="{type:'validatebox',options:{required:true}}">人住人数</th>
            </tr>
        </thead>
    </table>

转换不了

  • 写回答

2条回答 默认 最新

  • Go 旅城通票 2017-09-05 06:12
    关注

    配置都搞错了,列配着用data-options。。建议用js来创建,而不是样式

    其他列同样改过来,好好看别人的示例

                  <th field="ugender" width="100" data-options="editor="{type:'validatebox',options:{required:true}}",sortable:true,formatter:function(value,row,index){
                            console.log(value);
                            console.log(row.ugende);
                           if(row.ugende==1){
                             return '男';
                           }else if(row.ugende==2){
                            return '女';
                           }}">性别</th>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计