Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXTjs Panels collapse and expand methods

Tags:

extjs3

In EXT.Panel, there are two methods for collapsing/expanding a Panel.

collapse(Boolean animate)

and expand (Boolean animate)

calling collapse(true) and expand(true) gives me desired results. But I was hoping to achieve the result of expand(true) by calling collapse(false). But collapse(false) does nothing. Why is this?

like image 923
Victor Avatar asked Dec 17 '22 01:12

Victor


1 Answers

because collapse() and expand() functions don't check if panel is currently in expanded or collapsed mode, so if you call expand() on already expanded panel it will silently ignore the function call, you can use toggleCollapse() to collapse/expand based on current state of the panel

panel.toggleCollapse(true);

Extra:

the parameter used in collapse/expand functions is animate which just specifies the transition will be animated or not, it doesn't specify the state of the panel so collpase(false) just means the panel will be collapsed without any animation, but it if panel is already collapsed then function will just silently return without any processing, so in short collapse(false) is not equal to expand(true)

like image 133
Saket Patel Avatar answered Jan 31 '23 01:01

Saket Patel