문제

Is there any equivalent for lotus notes Dialog list in xpages? Or, if it's possible, an xpage combobox ''which accepts'' multiple values selected.

Thanks for your time

도움이 되었습니까?

해결책

Use a xe:djextListTextBox to collect and show multiple values, use xe:valuePicker to add values from an existing list to ListTextBox and use optionally a button to prompt for a new value and to add it to ListTextBox.

This is an example for xe:djextListTextBox and xe:valuePicker:

   <xe:djextListTextBox
      id="djextListTextBox1"
      multipleSeparator=","
      multipleTrim="true"
      defaultValue="abc,def"
      value="#{viewScope.test}">
   </xe:djextListTextBox>
   <xe:valuePicker
      id="valuePicker1"
      for="djextListTextBox1"
      pickerText="Add">
      <xe:this.dataProvider>
         <xe:simpleValuePicker>
            <xe:this.valueList><![CDATA[#{javascript:
               ["abc","def","ghj","klm","nop","xyz"]
            }]]></xe:this.valueList>
         </xe:simpleValuePicker>
      </xe:this.dataProvider>
   </xe:valuePicker>

enter image description here

I like this approach as it is for the user easy to add and to delete values and it looks good.

An alternative is the combination of xp:inputText and xe:valuePicker:

   <xp:inputText
      id="inputText1"
      multipleSeparator=","
      value="#{viewScope.test}"
      defaultValue="abc,def">
   </xp:inputText>
   <xe:valuePicker
      id="valuePicker1"
      for="inputText1">
      <xe:this.dataProvider>
         <xe:simpleValuePicker>
            <xe:this.valueList><![CDATA[#{javascript:
               ["abc","def","ghj","klm","nop","xyz"]
            }]]></xe:this.valueList>
         </xe:simpleValuePicker>
      </xe:this.dataProvider>
   </xe:valuePicker>

enter image description here

Users can add their own new values as the InputText field is editable. This approach might be a good solution if new values are allowed and users know how to edit values considering the multiple separator.

In case you'd like to have each value in a separate line you can use xe:djTextarea and set multipleSeparator to newline:

   <xe:djTextarea
      id="djTextarea1"
      multipleSeparator="#{javascript:'\n'}"
      value="#{viewScope.test}"
      defaultValue="#{javascript:['abc','def']}"
      cols="30">
   </xe:djTextarea>
   <xe:valuePicker
      id="valuePicker1"
      for="djTextarea1">
      <xe:this.dataProvider>
         <xe:simpleValuePicker>
            <xe:this.valueList><![CDATA[#{javascript:
               ["abc","def","ghj","klm","nop","xyz"]
            }]]></xe:this.valueList>
         </xe:simpleValuePicker>
      </xe:this.dataProvider>
   </xe:valuePicker>

enter image description here

The text box grows and shrinks with the number of selected values automatically.

다른 팁

The ValuePicker control in the Extension Library provides the Dialog List functionality, but not with the "Allow values not in list" functionality.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top