For expanding and Collapsing category entries in an XPage,
Go the all properties section of the XPage, Navigate to Data -> Data -> Expand Level as illustrated in the following figure
Also in case of a view containing multiple category columns, 1 will expand the first level categories with the other levels like 2nd or 3rd or so on collapsed.
Like wise specifying 2 here will expand the first category as well as the second category where as the 3rd or 4th or so on will be collapsed
Using a session scoped variable or a request scoped variable we can probably compute this on button clicks which might be handy for the end users...
Hope this helps :)