3

First of all, I'm a newbie to Webix and javascript.

Using Webix, can I collapse all accordion items by clicking the button? ID's of items are defined as string values. Sure i can write something like this:

$$("1").collapse();
$$("2").collapse();
$$("3").collapse();
...
$$("33").collapse();

But it seems "a little" unhandy. Here's the short snippet.

http://webix.com/snippet/748d84ac

I'll appreciate if anyone could explain if there's a better way.

4

1 回答 1

2

您可以使用getChildViewsAPI 获取所有手风琴面板,然后像下一个一样关闭它们

var cells = $$("acc_cl").getChildViews();
for (var i=0; i<cells.length; i++){
    cells[i].collapse();
}

http://webix.com/snippet/a462e807

于 2015-11-12T08:53:11.477 回答