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

Can the SingleExpandPath value be changed on the client side?

2 Answers 32 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Stefan asked on 30 Jan 2011, 11:44 PM
I have a TreeView embedded within a combobox that is doubling as both a user-navigable tree and a filtered autocomplete tree if the user is typing into the combobox.
When the user is clicking through the tree, I want the SingleExpandPath behaviour to be used.
When they are typing and the (partial) tree is being filtered and displayed to them, I'd like this behaviour to be disabled since the filtered set of nodes will come from various branches of the tree.

I'd like to disabled this property in the combobox's OnClientKeyPressing event, and re-enable it on the OnClientDropDownOpened event. I haven't seen anything in the client side API that lets me control this.

2 Answers, 1 is accepted

Sort by
0
Stefan
Top achievements
Rank 1
answered on 31 Jan 2011, 12:05 AM
Answering my own question: this exists and is in the client API, it's just not documented in the TreeView API reference.

I'm getting my desired behaviour with:

        
function ComboBoxKeyPressing(sender, e)
        {
            var tree = sender.get_items().getItem(0).findControl("RadTreeView");
            tree.set_singleExpandPath(false);
        }
 
        function DropDownOpenedHandler(sender, eventArgs) {
            var tree = sender.get_items().getItem(0).findControl("RadTreeView");
            tree.set_singleExpandPath(true);
        }
 
        <telerik:RadComboBox ID="RadComboBox1" runat="server" EmptyMessage="Type to search"
            OnClientDropDownOpened="DropDownOpenedHandler" AllowCustomText="true" ShowDropDownOnTextboxClick="false"
            OnClientKeyPressing="ComboBoxKeyPressing">
            <ItemTemplate>
                <div id="div1">
                    <telerik:RadTreeView ID="RadTreeView" runat="server" />
                </div>
            </ItemTemplate>
            <Items>
                <telerik:RadComboBoxItem Text="" />
            </Items>
        </telerik:RadComboBox>
0
Stefan
Top achievements
Rank 1
answered on 31 Jan 2011, 09:32 PM
(For anyone arriving from a search engine)
This code example from the How-To section also describes how to do this without using the SingleExpandPath property:

http://www.telerik.com/help/aspnet-ajax/client-expand-only-one-per-level.html
Tags
TreeView
Asked by
Stefan
Top achievements
Rank 1
Answers by
Stefan
Top achievements
Rank 1
Share this question
or