數控件默認是全部展開的,我想把他弄成默認關閉的怎麼做?
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#"
}]
}]