Oleksandr Fentsyk
Oleksandr Fentsyk

Reputation: 5386

How can i collapse all parents for one branch?

I have tree in my shop. I need when i go trough some good i need open exactly that branch that contain my good.

<ul id="treeview" class="treeview-black">
    <li>Item 1</li>
    <li>
        <span>Item 2</span>
        <ul>
            <li>
                <span>Item 2.1</span>
                <ul>
                    <li>Item 2.1.1</li>
                    <li>Item 2.1.2</li>
                </ul>
            </li>
            <li>Item 2.2</li>
            <li>
                <span>Item 2.3 (closed at start)</span>
                <ul>
                    <li>Item 2.3.1</li>
                    <li>Item 2.3.2</li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

$("#treeview").treeview({
   animated: "fast",
   collapsed: true,
   unique: true,
   persist: "location"
});

I need open some branch when page will be open and do this with JavaScript code. Thanks in advance.

Upvotes: 0

Views: 141

Answers (1)

Related Questions