1

I've got a checkBoxGroup that can expand to 20 items or so, as users pick which fields from a view that they want to export to a spreadsheet. I'm curious how I might control the display of those 20 checkboxes (dynamically determined) to be in more than one row or even to display in a column instead.

<xp:checkBoxGroup id="fieldChoicesBox">
    <xp:eventHandler event="onclick" submit="false" id="eventHandler2">
       <xp:this.script>
       <![CDATA[var x= '#{javascript:getClientId("fieldChoicesBox")}';
                var y= '#{javascript:getClientId("fieldChoicesBoxList")}';
                copyRadioChoices(x,y)]]>
       </xp:this.script>
    </xp:eventHandler>
    <xp:selectItems>
       <xp:this.value>
          <![CDATA[#{javascript: var viewName=@UpperCase(getComponent("viewChoice").getValue());
                     var tmp = @DbLookup(@DbName(),"dbprofile",viewName,"Value");
                     @If(@IsError(tmp),"None",tmp)}]]>
       </xp:this.value>
    </xp:selectItems>
</xp:checkBoxGroup>

This is all built off code I originally got from Russ Maher (see http://xpagetips.blogspot.com/2012/06/extending-your-xpages-applications-with.html) so any brilliance is attributable to him, while all mistakes are mine.

Alternatively, if you have an idea for how to pick fields or columns to display in the export that works more easily or elegantly, I'd be thrilled to hear it.

David Navarre
  • 1,022
  • 10
  • 27

1 Answers1

1

If your using or can use the ExtLib I'd use the valuePicker control, lets you select multiple values from the one control ( hold down ctrl while choosing ). Heres an example:

<xp:inputtext id="example" multipleSeparator=","></xp:inputText>
<xe:valuePicker for="example" pickerText="text">
    <xe:this.dataProvider>
        <xe:simpleValuePicker valueList="test1, test2, test3, test4"
            valueListSeperator=",">
        </xe:simpleValuePicker>
    </xe:this.dataProvider>
</xe:valuePicker>
Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56
  • Thanks, Simon. That beats the heck outta checkboxes! – David Navarre Jul 11 '12 at 19:01
  • @Simon - Is there a way to "Select All" values in a valuePicker control instead of selecting one at a time? – Ryan Buening Oct 24 '13 at 20:02
  • @RyanBuening Sorry I was answering XPages questions while I worked in IBM for the XPages team. I left IBM over a year ago, haven't done anything with XPages since I left or seen the new updates etc. I'd recommend asking a new question and someone who follows the tag will find it and help you out – Simon McLoughlin Oct 25 '13 at 08:51