This is a migrated thread and some comments may be shown as answers.

Child nodes not inheriting parent checked value when load on demand

6 Answers 91 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Yaron Lavi
Top achievements
Rank 1
Yaron Lavi asked on 11 Apr 2010, 04:36 PM
Hi,
I'm using a RadTreeView like this:

<

 

telerik:RadTreeView ID="WebTreeFolders"

 

 

runat="server"

 

 

Height="100%"

 

 

CheckBoxes="True"

 

 

CheckChildNodes="true"

 

 

PersistLoadOnDemandNodes="false"

 

 

EnableViewState="false" >

 

 

 

<WebServiceSettings Path="Export.aspx" Method="GetNodeItems" />

 

 

</telerik:RadTreeView>

The treeview loads child node when expanded using a static page method, and eveything works fine but the following scenario:
1) A node which NOT expanded is checked.
2) that node is then expanded.
3) Upon expand, the child nodes are populated using a web service method.
4) child node appear un-selected, although their parent node is selected.

How can I overcome this?

 

6 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 13 Apr 2010, 01:12 PM
Hello Yaron Lavi,

Please check this how-to article:

Inherit the the Checked state of the parent Node when loading Nodes on demand

Greetings,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Yaron Lavi
Top achievements
Rank 1
answered on 13 Apr 2010, 01:24 PM
Your solution will only work if the node's ExpandMode in ServerSideCallback, because in this case you have control over the nodes you're creating.

If the node's expandMode is webService or a shared (static) page method, you are required to return an array to RadTreeNodeData instances, which do not have a 'Checked' property. The nodes created from these RadTreeNodeData will NEVER be cheked, even if their parent node is chekced.

So basically your suggestion is to ditch the webservice expnad mode and use serversidecallback instead?

And another issue: my treeview uses 'Office2007' skin with checkboxes. The style of the checkboxes of the nodes created using load-on-demand looks different than the root nodes I've created programatically. I haven't made a specific styling to the nodes, just using them as-is. what coulkd be the cause?
0
Veselin Vasilev
Telerik team
answered on 13 Apr 2010, 03:21 PM
Hi Yaron Lavi,

I believe that this help topic will help you to add a Checked property to your nodes:

Setting additional properties to the node in the Web Service 

You should check the nodes (node.check()) in the OnClientNodeDataBound event depending on the additional property you defined.

As for the second problem - do you use RadFormDecorator? If so, what happens when you remove it?

Best wishes,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Yaron Lavi
Top achievements
Rank 1
answered on 19 Apr 2010, 09:04 AM
Yes, I'm using a decorator in this form:

 

 


 

<

 

telerik:RadFormDecorator ID="radd2" runat="server" DecoratedControls="All" />

 

&lt;</FONT></FONT><FONT color=#a31515 size=2><FONT color=#a31515   
size=2>telerik</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff   
size=2>:</FONT></FONT><FONT color=#a31515 size=2><FONT color=#a31515   
size=2>RadFormDecorator</FONT></FONT><FONT size=2</FONT><FONT color=#ff0000   
size=2><FONT color=#ff0000 size=2>ID</FONT></FONT><FONT color=#0000ff   
size=2><FONT color=#0000ff size=2>="radd2"</FONT></FONT><FONT size=2>   
</FONT><FONT color=#ff0000 size=2><FONT color=#ff0000   
size=2>runat</FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff   
size=2>="server"</FONT></FONT><FONT size=2</FONT><FONT color=#ff0000   
size=2><FONT color=#ff0000 size=2>DecoratedControls</FONT></FONT><FONT   
color=#0000ff size=2><FONT color=#0000ff size=2>="All"</FONT></FONT><FONT   
size=2</FONT><FONT color=#0000ff size=2><FONT color=#0000ff   
size=2>/&gt;</FONT></FONT


Removing it has no impact - child nodes' checkbox is still drawn differently.
0
Veselin Vasilev
Telerik team
answered on 21 Apr 2010, 01:19 PM
Hi Yaron Lavi,

Please find attached a sample project. It is actually easier than I thought - you just need to inherit the RadTreeNodeData class and add the Checked property to the new class and the tree will render the checkboxes automatically (no need to hook on the OnClientNodeDataBound event). And the look and feel of the child nodes is the same as the parent node.

Regards,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Oren Halevi
Top achievements
Rank 1
answered on 03 Nov 2010, 05:18 PM
This is exactly what I was looking for!!! thank you
Tags
TreeView
Asked by
Yaron Lavi
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Yaron Lavi
Top achievements
Rank 1
Oren Halevi
Top achievements
Rank 1
Share this question
or