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.

1 Answers1

2

You can use getChildViews API to get all accordion panels, and close them like next

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

http://webix.com/snippet/a462e807

Roman V.
  • 298
  • 1
  • 4