开发者

jQuery treeView plugin collapse/expand all

I Would like to have two buttons on my site. Expand All, collapse All

Im using treeView jquery plugin: http://plugins.jquery.com/project/treeview

I cant find solution for doing that :/

Also while im generating ul li list dynamically on aspx server side code I would like do determine accorgind to queryString parameter which node should be expanded while others closed. I tried adding to 开发者_高级运维each one class closed while to given one none but it didnt work :/

How can I say which node should be expanded ?

Thanks for any help, bye


If you look at the demo's you should see exactly what you need for example 4.

Add the following to your page:

<div id="treecontrol">
    <a title="Collapse the entire tree below" href="#"><img src="../images/minus.gif" /> Collapse All</a>
    <a title="Expand the entire tree below" href="#"><img src="../images/plus.gif" /> Expand All</a>
    <a title="Toggle the tree below, opening closed branches, closing open branches" href="#">Toggle All</a>
</div>

And when you wire up your tree control specify the 'treecontrol'

$("#black, #gray").treeview({
  control: "#treecontrol"
});

Be warned
The order of your anchor tags is important in your control as the plugin uses .eq() to assign the appropriate functions.

$("a:eq(0)", control).click(handler(CLASSES.collapsable));
// click on second to expand tree
$("a:eq(1)", control).click(handler(CLASSES.expandable));
// click on third to toggle tree
$("a:eq(2)", control).click(handler());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜