JSTree 默认展开 树节点默认展开
红色部分
$("\#jstree\_demo")
.jstree(\{
"core" : \{
"animation" : 0,
"check\_callback" : true,
'force\_text' : true,
"themes" : \{ "stripes" : true \},
// so that create works
"check\_callback" : true,
'data' : function (obj, callback) \{
var jsonstr="\[\]";
var jsonarray = eval('('\+jsonstr+')');
$.ajax(\{
type: "POST",
url:url,
dataType:"json",
async: false,
success:function(result) \{
var arrays= result;
for(var i=0 ; i<arrays.length; i++)\{
console.log(Object.getOwnPropertyNames(arrays\[i\]).sort());
var arr = \{
"id":arrays\[i\].id,
"parent":arrays\[i\].pid==""?"\#":arrays\[i\].pid,
"text":arrays\[i\].name,
"type":arrays\[i\].iconSkin,
"state": \{"opened" : true\}
//"state": \{"selected":true\}
\}
jsonarray.push(arr);
\}
\}
\});
callback.call(this, jsonarray);
\}
\},
"plugins" : \[ "search", "state", "types", "wholerow","checkbox" \]
\});
还没有评论,来说两句吧...