Speak - How can you rebind a Treeview?

Hey,

I'm having some difficulties trying to rebind a TreeView based on a selected item from a ComboBox.

I updated the 'data-sc-rootitem' and 'data-sc-rootitempath' and reinitialzed the treeView.viewModel. (this.treeView.viewModel.initialized();)

This adds my newly selected root item, but also keeps the previous site.

How can I reinitialize the TreeView?

  • In reply to Mike Robbins:

    Hey Michael,

    I've found a solution :-)

    Here is how I reload the TreeView:

    reloadTreeview: function (rootInfo, rootPath) {
                var selector = this.CoCTreeView.attributes.type;
                var treeView = $('.' + selector);
    
                treeView.attr('data-sc-rootitem', rootInfo);
                treeView.attr('data-sc-rootitempath', rootPath);
    
                this.CoCTreeView.viewModel.getRoot().removeChildren();
                this.CoCTreeView.viewModel.checkedItemIds([]);
    
                this.CoCTreeView.viewModel.initialized();
            }

    Thanks for pointing me to DynaTree, this helped solve the issue!