Hello. I create UI TreeView using my classes for this and and using TreeView API for create custom inspector window (MultiColumnTreeView). But when i use custom window for adding new elements on treeView, that Treeview in custom window don’t showing it. I know that i should use method Reload(); or Repaint();, but it don’t working. What should i doing for solve this problem?
Here my structure of treeView in TreeViewCreater script:
[99006-treeviewcreater.png*_|99006]
Here showing this structure in custom window:
[99007-multicolumntreeview.png*_|99007]
Added element i can see their in TreeViewCreater script, but not in window. If I reload my window(close and again open), than elements are showing.
Here I get data from script:
public static List<MultiColumnTreeElement> GenerateTreeFromList()
{
var treeViewCreater = GameObject.Find("Canvas").GetComponent("TreeViewCreater");
var treeNodeList = (treeViewCreater as TreeViewCreater).TreeNodeList;
var treeElements = new List<MultiColumnTreeElement>(1);
treeElements.Clear();
IDCounter = 0;
var root = new MultiColumnTreeElement("Root", -1, IDCounter, "root");
treeElements.Add(root);
for (int i = 0; i < treeNodeList.Count; i++)
{
var newNode = new MultiColumnTreeElement( /*"element " + i*/ treeNodeList_.Name, root.depth + 1, ++IDCounter /*IDCounter*/, treeNodeList*.Text);*_
treeElements.Add(newNode);
CreateTreeFromListTreeView(newNode, treeNodeList*.Children, treeElements);*
}
return treeElements;
}
static void CreateTreeFromListTreeView(TreeElement element, List<TreeViewCreater.TreeNode> treeNodeList, List treeElements )
{
for (int i = 0; i < treeNodeList.Count; i++)
{
var node = new MultiColumnTreeElement(treeNodeList_.Name, element.depth + 1, ++IDCounter /* ++IDCounter*/, treeNodeList*.Text);*
treeElements.Add(node);_
CreateTreeFromListTreeView(node, treeNodeList*.Children, treeElements);*
}
Here my BuildRows:
protected override IList BuildRows(TreeViewItem root)
{
var rows = base.BuildRows(root);
return rows;
}
Base BuildRows:
* protected override IList BuildRows (TreeViewItem root)*
* {*
* if (m_TreeModel.root == null)
_ {
Debug.LogError (“tree model root is null. did you call SetData()?”);
}*_
* m_Rows.Clear ();
_ if (!string.IsNullOrEmpty(searchString))
{_
Search (m_TreeModel.root, searchString, m_Rows);
_ }
else*
* {_
if (m_TreeModel.root.hasChildren)
AddChildrenRecursive(m_TreeModel.root, 0, m_Rows);
_ }*_
* // We still need to setup the child parent information for the rows since this*
* // information is used by the TreeView internal logic (navigation, dragging etc)*
* SetupParentsAndChildrenFromDepths (root, m_Rows);*
* return m_Rows;
_ }
Thank you.
_*