一只会飞的白菜 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条回答 默认 最新

  • 斯洛文尼亚旅游 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条)

报告相同问题?