另一种方法创建EasyUI中的PropertyGrid

 现在有需求新建一个EasyUI中的PropertyGrid控件,在网上找了半天,都是用json传值的,官网上的例子如下:

 $('#tt').propertygrid({
width:300,
height:'auto',
url:'propertygrid_data.json',
showGroup:true,
scrollbarSize:0
});

这样需要新建一个json文件,于是我就想有没有什么办法直接用一个js文件就可以完成以上操作呢,试了很久,发现办法还是有的,现贴出来供有需求的朋友参考,如果有更好的方法欢迎在留言中贴出来,以便大家互相学习。


var rows = [
        { "name": "姓名", "group": "帐号", "value": "", "editor": "text" },
        { "name": "帐号", "group": "帐号", "value": "", "field": "id", "editor": "text" },
        { "name": "职位", "value": "", "group": "其它", "field": "Role", "editor": { "type": 'combobox', "options": { "valueField": 'value', "textField": 'name', "url": '../../home/GetSelectItems_Role', "required": true}} },
        { "name": "办公电话", "value": "", "group": "其它", "field": "officePhone", "editor": "text" },
        { "name": "移动电话", "group": "其它", "value": "", "field": "mobilePhone", "editor": { "type": 'validatebox', "options": { "required": true}} },
        { "name": "集团短号", "group": "其它", "editor": "text", "value": "", "field": "mobilePhoneShort" },
        { "name": "第二联系方式", "group": "其它", "value": "", "field": "phoneSecond", "editor": { "type": 'validatebox', "options": { "required": true}} },
        { "name": "备注", "group": "其它", "editor": "text", "value": "", "field": "remark" }
    ];


$('#edit').propertygrid({

        width: 298,
        height: 'auto',
        showGroup: true,
        scrollbarSize: 0,
        columns: [[
                { field: 'name', title: 'Name', width: 100, resizable: true },
                { field: 'value', title: 'Value', width: 100, resizable: false }
        ]]
    });

    $('#edit').propertygrid('loadData', rows);


效果图:





转载于:https://www.cnblogs.com/QiuJL/archive/2012/08/15/4524213.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值