This question is locked. New answers and comments are not allowed.
I have a TreeView that will:
* if I click a node - fire a GET to the server to update the page -> this allows me to prsent data that is related to the node selected.
* double click will expand the node
I have tried the example posted in the forums to expand a node on a single click and it works, BUT the click will only do the GET for the FIRST click. After that all it does is expand/collapse the TreeView on a single click.
Also the Expander() code doesn't work at all for me. Any ideas why?
* if I click a node - fire a GET to the server to update the page -> this allows me to prsent data that is related to the node selected.
* double click will expand the node
I have tried the example posted in the forums to expand a node on a single click and it works, BUT the click will only do the GET for the FIRST click. After that all it does is expand/collapse the TreeView on a single click.
Also the Expander() code doesn't work at all for me. Any ideas why?
<script type="text/javascript">
function onSelect() { }
function onTreeViewLoad() {
var treeview = $('#TreeView').data('tTreeView');
$(treeview.element)
.delegate('div:not(.t-state-disabled) > .t-in', 'click', $.telerik.delegate(treeview, treeview.nodeClick))
}
</script>
<script runat="server">
public void Expander(TreeViewItem item)
{
if (item.Parent == null) return;
item.Expanded = true;
Expander(item.Parent);
}
</script>
<% Html.Telerik().TreeView()
.Name("TreeView")
.ClientEvents(events => events
// .OnSelect("onSelect")
.OnLoad("onTreeViewLoad"))
.BindTo(Model.Categories, mappings =>
{
mappings.For<Category>(binding => binding
.ItemDataBound((item, category) =>
{
item.Text = category.Name;
// item.ControllerName = "Category";
// item.ActionName = "Term";
item.Value = category.Id.ToString();
item.Action<CategoryController>(xx => xx.Index(category.Id, null, "", false, "", ""));
// if (category.Id == 8)
// Expander(item);
})
.Children(category => category.Categories));
mappings.For<Category>(binding => binding
.ItemDataBound((item, subcategory) =>
{
item.Text = subcategory.Name;
// if (item.Value == "8")
// Expander(item);
}));
}).Render();
%>