数控件默认是全部展开的,我想把他弄成默认关闭的怎么做?
API上是这样写的:state:节点状态,'open' 或 'closed',默认:'open'。如果为'closed'的时候,将不自动展开该节点。
然后我按照他说的写:
$(function(){
$('#account_ul').tree({
lines:true,
state:'closed',
});
});
测试数据显示有虚线,可是还是打开的状态,怎么办?
是数据源增加,tree的配置没有state这个配置
[{
"id":1,
"state":"closed",
"text":"Folder1",
"iconCls":"icon-save",
"children":[{
"text":"File1",
"checked":true
},{
"text":"Books",
"state":"open",
"attributes":{
"url":"/demo/book/abc",
"price":100
},
"children":[{
"text":"PhotoShop",
"checked":true
},{
"id": 8,
"text":"Sub Bookds",
"state":"closed"
}]
}]
},{
"text":"Languages",
"state":"closed",
"children":[{
"text":"Java"
},{
"text":"C#"
}]
}]