Hi all,
Using the latest trial-version of the ajax-controls, my treeview loads-on-demand from a web service. This works brilliantly and looks shhweeeet! :-)
The problem is that the child-level inherits the "checkboxes=true" property from the treeview-control and there doesn't seem to be a way turn that off! I need only my top-levels to be checkable - is there any way to obtain this functionality?
Thanks in advance,
/Don.
Using the latest trial-version of the ajax-controls, my treeview loads-on-demand from a web service. This works brilliantly and looks shhweeeet! :-)
The problem is that the child-level inherits the "checkboxes=true" property from the treeview-control and there doesn't seem to be a way turn that off! I need only my top-levels to be checkable - is there any way to obtain this functionality?
Thanks in advance,
/Don.
8 Answers, 1 is accepted
0
-DJ-
Top achievements
Rank 1
answered on 25 Sep 2008, 02:19 PM
Hi Don,
One way would be to exchange the = with > in this example:
http://www.telerik.com/community/forums/thread/b311D-bgdbeg.aspx
Regards,
-DJ-
One way would be to exchange the = with > in this example:
http://www.telerik.com/community/forums/thread/b311D-bgdbeg.aspx
Regards,
-DJ-
0
DonRex
Top achievements
Rank 1
answered on 25 Sep 2008, 05:25 PM
Hi DJ!
Thanks! Unfortunately neither the NodeCreated or NodeDatabound-event is triggered when the children are loaded from the web service, so that doesn't seem to solve my problem.
Thanks,
Don.
Thanks! Unfortunately neither the NodeCreated or NodeDatabound-event is triggered when the children are loaded from the web service, so that doesn't seem to solve my problem.
Thanks,
Don.
0
Hello DonRex,
You can handle the OnClientNodeDataBound instead, which fires regardless of the type of data binding. Then in the event handler you can use get_toggleElement() to get a reference to the CheckBox of a Node and remove it from the DOM.
I hope this helps.
Best wishes,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can handle the OnClientNodeDataBound instead, which fires regardless of the type of data binding. Then in the event handler you can use get_toggleElement() to get a reference to the CheckBox of a Node and remove it from the DOM.
I hope this helps.
Best wishes,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
DonRex
Top achievements
Rank 1
answered on 25 Sep 2008, 06:26 PM
Simon, that worked like a charm, thank you!
I'm sure, however, that you meant "get_element()" and not "get_toggleElement()". :-)
For anyone interested in the solution, here it is:
TreeView definition:
<telerik:RadTreeView CheckBoxes="true" OnClientNodeDataBound="ClientNodeDataBound" EnableViewState="true" ID="RadTreeView1" runat="server"/>
ClientNodeDataBound-event handler
I'm sure, however, that you meant "get_element()" and not "get_toggleElement()". :-)
For anyone interested in the solution, here it is:
TreeView definition:
<telerik:RadTreeView CheckBoxes="true" OnClientNodeDataBound="ClientNodeDataBound" EnableViewState="true" ID="RadTreeView1" runat="server"/>
ClientNodeDataBound-event handler
<script language="javascript" type="text/javascript"> |
function ClientNodeDataBound(sender, eventArgs) |
{ |
var tree = sender; |
var node = eventArgs.get_node(); |
var inputs = node.get_element().getElementsByTagName('input'); |
for (var i = 0; i < inputs.length; i++) |
{ |
if (inputs[i].getAttribute('type') == 'checkbox') |
inputs[i].style.display = 'none'; |
} |
} |
</script> |
0
Hi DonRex,
get_toggleElement() returns the checkbox. You don't need this code:
var inputs = node.get_element().getElementsByTagName('input');
All the best,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
get_toggleElement() returns the checkbox. You don't need this code:
var inputs = node.get_element().getElementsByTagName('input');
All the best,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
DonRex
Top achievements
Rank 1
answered on 26 Sep 2008, 11:59 AM
Albert,
That is strange.
get_toggleElement() returns 'null' here:
Do I need to implement it in another way or am I missing something completely?
eventArgs.get_toggleElement() doesn't work either.
Thanks in advance,
/Don.
That is strange.
get_toggleElement() returns 'null' here:
function ClientNodeDataBound(sender, eventArgs) |
{ |
var tree = sender; |
var node = eventArgs.get_node(); |
var input = node.get_toggleElement(); |
alert(input); // returns 'null' |
} |
Do I need to implement it in another way or am I missing something completely?
eventArgs.get_toggleElement() doesn't work either.
Thanks in advance,
/Don.
0
Accepted
Hello DonRex,
Excuse me for misleading you. The proper method is get_checkBoxElement(). get_toggleElement() returns the expand/collapse image which is null for child nodes.
Greetings,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Excuse me for misleading you. The proper method is get_checkBoxElement(). get_toggleElement() returns the expand/collapse image which is null for child nodes.
var node = eventArgs.get_node(); |
var input = node.get_checkBoxElement(); |
Greetings,
Albert
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
DonRex
Top achievements
Rank 1
answered on 26 Sep 2008, 12:07 PM
Albert,
Wonderful! That did the trick! I thought I was losing my mind. :-)
Thanks again,
/Don.
Wonderful! That did the trick! I thought I was losing my mind. :-)
Thanks again,
/Don.