我在测试的时候,发现checkBOXTree绑定数据的时候,提示错误以下:html
validating checkbox data: " TypeError: Cannot read property 'length' of undefined数据库
以后发现是,数据的格式问题,不标准的数据格式每每会致使各类错误!json
数据必定按json格式问题,json格式中必须包含identifier和label,items。下图是一组标准的数据格式,能够按照这个格式绑定数据:数组
var liZi={ identifier:'', label:'', items:[//我是数组,表示家庭成员 {//妈妈 name:"妈妈叫小红", age:"小红年龄30岁", children:[//妈妈的孩子 { name:"女儿叫小丽", age:"年龄10岁" } ] }, {//姥姥 name:"姥姥叫小美", age:"小美年龄60岁", children:[//姥姥的儿子 { name:"儿子叫小强", age:"年龄40岁" } ] } ] }
诸如此类还有ItemFileWriteStore,注意items包含的数据是数组格式。服务器
下面是一个checkBOXTree和ItemFileWriteStore均可以用的简单的数据例子:ide
{ "identifier":"code", "label":"name", "items":[ { "name":"数据库服务器", "children":[ { "name":"orcl数据库", "checkbox":false, "pid":"0", "code":"141-3", "type":"3" } ], "pid":"421", "code":"421-2", "type":"2" } ] }
本人新手一个,文字表达能力通常,有错误但愿各位指正测试