0
votes

I'm trying to hide/show a button which lays on a xpage depdending on the number of docs. selected from a viewPanel.

<xp:this.rendered><![CDATA[#{javascript:var viewPanel=getComponent("viewPanel1");
var docIDArray=viewPanel.getSelectedIds(); 

if (docIDArray.length != null ){ return true; }

else { return false; }}]]>
</xp:this.rendered>

How can I make a partial refresh ( if it's necessary ) for the button component while I'm selecting some documents using the showCheckbox property of a column?

2

2 Answers

3
votes

You can't. The showCheckbox option, like much of the View Panel itself, gives simple access to limited functionality for selecting documents and then running a function on them.

If you want to trigger functionality on the click of a checkbox, you'll need to manually add a CheckBox control in a separate column. But you'll also need to create the functionality to capture selected documents yourself, e.g. add the ID to a viewScope variable, removing it if it's already in the viewScope variable. You'll also want to compute whether each checkbox should default to checked, based on whether the ID is in the viewScope variable. It's pretty straightforward functionality to create, if you break it down into what needs to happen at each part of the process. (I was able to recreate that kind of functionality fairly early on in my XPages experience with just a bit of knowledge of SSJS.)

1
votes

Stop using View Panels. Use repeat controls. Repeat controls have NO UI. that means you can pretty much do whatever you want. A good example is here: http://notesin9.com/index.php/2011/07/11/notesin9-ee-009-using-java-hashmaps-and-treemaps-with-xpages/

That example shows how to select multiple documents from a repeat control. So it's somewhat close to your actual question.