In MVC 4 i use jstree. In create operation I have not problem. But in Edit operation, I set true
value to some items of treemodel. models are like:
public class RecursiveObject
{
public string data { get; set; }
public Int64 id { get; set; }
public FlatTreeAttribute attr { get; set; }
public List<RecursiveObject> children { get; set; }
}
public class FlatTreeAttribute
{
public string id;
public bool selected;
}
When I fill tree model, i set selected = true;
to some items and use this in view:
json_data: {
"ajax": {
url: "@Url.Action("GetTreeData", "MyController")",
type: "POST",
dataType: "json",
contentType: "application/json charset=utf-8"
}
},
But in view, all items are unchecked. I see some <li>
tags have selected = "selected"
, but this does not affect it's checking.
When I check item manually, jstree-unchecked
changes to jstree-checked
class. It means that selected = "selected"
does not work.
How can I solve this issue?