XPages – categorized view and multiple partial refresh

I am currently working with one of my trainees on a webinterface based on XPages for one of our applications. The application is a contant management system and one of our aims is to avoid modifications on the application and therefore having the XPages design apart from the data in a separate application.

Yesterday we tried to manually build a categorized view using repeated repeats. Thanks to Twitter, David Leedy pointed me to one of his NotesIn9 episodes where he describes, how to build a cat. view based on repeat controls.

There is also an online example that demonstrates, how it looks and works.

But we wanted to have the view to look and behave more like the client. No problem to replace the buttons by plus/minus images and to put them in front of the category.

Next problem to solve was to hide one of the images according to the expand / collapse state of the category.

This can simply be done by setting the rendered property. But you have to do a partial refresh to hide or unhide the images. In the Designer UI you can only set ONE partial refresh, but we needed to do at least 2 partial updates. So we got stuck a little.

Twitter to the resque once again. Per Lausten replied minutes after my call for help and wrote that Matt White had talked about multiple partial refresh in one of his recent xpages101 online lessons.

Now we had everything to build the custom control. Here is how it looks in the designer.

And here is the result. Left picture shows the view in the client and the picture on the right the output of the control on the web.

Last but not least, here is the sourcecode. Source: categorized view with multiple partial refresh.

The client side code to perform the partial refresh was first mentioned by Tim Tripcony.

It might not be perfect and perhaps there is a better way to build the view, but we both learnt a lot.

And once again this example shows that Notes has a great community and there is plenty of knowledge spread all over the internet. You only have to ask for help if you get stuck.