Monday, May 27, 2013
Trigger Select All Checkbox Click in XPage view panels in XPages
This post shows the method through which the select all button that you would enable on a Xpage view panel can be programatically clicked.
I found need for a scenario in which I would require the document ids of all documents that are being displayed on a Xpage view in a browser. Eventually the simplest userfrinedly/user interactive mechanism that I was able to think about was the native select all feature available with the XPage view controls in Lotus Notes.
It took me quite a while to understand the usage though, It was quite tricky and tough but not any more :)
Following is the code fragment that allowed me to do this silly stuff
//-- Following line of code has been commented and the forth comming lines, second and third respectively
var selectAllCheckBoxes=getElementsByClassName(viewPanelContainer, "xspCheckBoxViewColumnHeader");
//-- End of block highlighting the work around for an IE bug
Here I am using a function named as getElementsByClassName. The function is available in the blog, you can simply search for the same using the name itself or use any other method that you have. This is essential for the code to work in the tremendously awesome Internet explorer crap.
For all other poor browsers out there, they are in capable of making my life difficult and hence a simple object.getElementsByClassName will work on them
Hope this helps :)