Can the SingleExpandPath value be changed on the client side?

3 posts, 0 answers
  1. Stefan
    Stefan avatar
    16 posts
    Member since:
    Jun 2010

    Posted 30 Jan 2011 Link to this post

    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. Stefan
    Stefan avatar
    16 posts
    Member since:
    Jun 2010

    Posted 30 Jan 2011 Link to this post

    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>
  3. Stefan
    Stefan avatar
    16 posts
    Member since:
    Jun 2010

    Posted 31 Jan 2011 Link to this post

    (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
Back to Top