Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

I have object which has properties
1. name: String
2. selected: Boolean 


I'm, creating Kendo UI TreeView using this object.

My issue is I want to create nodes for only those items in the object whose selected value is false.

Any idea how to do in in Kendo UI?

Thanks in advance
Posted
Comments
Kornfeld Eliyahu Peter 11-Jun-14 8:15am    
How do you bind your data to the TreeView without filter?
dhage.prashant01 12-Jun-14 0:20am    
We are using MVVM pattern using typescript and kendo bindings..
So in our view we are populating viewmodel and sending it to the common function which takes the element to bind, viewmodel.

following is my template code
<script id="AvailableKpiTilesTemplate" type="text/html">
<div><span class="treeview-title" data-bind="text: GetString('Summary_Panel_Available_Metrics')"></span> </div>
<div id ="available-tile-tree-view" data-template="treeTemplate" data-role="treeview" data-bind="source: Tiles" ></div>
</script>

<script id="treeTemplate" type="text/x-kendo-template">
# if (item.Selected) { #
<div class='tree-view-item-unselect tree-view-item-select'> #= item.DisplayName #<span class='add-tile'></span></div>
# } else { #
<div class='tree-view-item-unselect'> #= item.DisplayName #</div>
# } #
</script>

If you see my if part, if item.selected == true then you cant select the node.
I have to make change, I don't want to display the node itself.

If I remove the if part, it works fine but when treeview is created it generates <ul></ul> list and nodes which are generated u have blank <li></li>, so the UI get wrong behavior.

In sort, I want to avoid generation of the <li></li>.
any idea?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900