lyon_fanfan 2009-10-29 17:27
浏览 252
已采纳

如何实现动态生成带checkbox的tree?后台是C# 尤其是checkbox属性的设置

如何实现动态生成带checkbox的tree?后台是C# 尤其是checkbox属性的设置

  • 写回答

1条回答 默认 最新

  • zhoujuan520 2009-10-30 00:27
    关注

    从后台返回json串的时候,树节点包含一个属性checked:false/true
    [code="js"]{text:'树节点,checked:true}//这样返回的节点就是选中的,false则不选中,具体的checkbox树,请参考官网示例[/code]

    [url]http://www.extjs.com/deploy/dev/examples/tree/check-tree.html[/url]

    一下是官网示例返回的json

    [code="js"]
    [{
    text: 'To Do',
    cls: 'folder',
    children: [{
    text: 'Go jogging',
    leaf: true,
    checked: false
    },{
    text: 'Take a nap',
    leaf: true,
    checked: false
    },{
    text: 'Climb Everest',
    leaf: true,
    checked: false
    }]
    },{
    text: 'Grocery List',
    cls: 'folder',
    children: [{
    text: 'Bananas',
    leaf: true,
    checked: false
    },{
    text: 'Milk',
    leaf: true,
    checked: false
    },{
    text: 'Cereal',
    leaf: true,
    checked: false
    },{
    text: 'Energy foods',
    cls: 'folder',
    children: [{
    text: 'Coffee',
    leaf: true,
    checked: false
    },{
    text: 'Red Bull',
    leaf: true,
    checked: false
    }]
    }]
    },{
    text: 'Remodel Project',
    cls: 'folder',
    children: [{
    text: 'Finish the budget',
    leaf: true,
    checked: false
    },{
    text: 'Call contractors',
    leaf: true,
    checked: false
    },{
    text: 'Choose design',
    leaf: true,
    checked: false
    }]
    }]
    [/code]

    另外extjs是客户端脚本语言,服务器语言使用C#,JAVA都是无关的.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突