Florin M.
Florin M.

Reputation: 2169

xpages Value picker multiple databaseNames

Is it possible inside a <xe:valuePicker> to declare 2 daatabaseNames ?

I want to concatenate 2 views from 2 different databases and letting the user having the right to select more than one value.

For the first view, I do want all the entries listed.

For the 2nd view, I'd want to grab the entries like:

@Unique(@DbLookup("server!!my.nsf", "vwNumeCP", hehe, 2));

where

var hehe = docProiect.getItemValueString("Comp");

Upvotes: 1

Views: 610

Answers (2)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15729

An alternative to the beanValuePicker are the mapPicker and listPicker classes that I've added XSnippets for http://openntf.org/XSnippets.nsf/snippet.xsp?id=mappicker-dataprovider-for-vaue-picker. This allows you to pass a Java List, Set or Map in as the source. I've also done a series of blog posts about it http://www.intec.co.uk/tag/selections-tutorial/

The Java classes have been incorporated into OpenNTF Domino API as native dataProviders.

Upvotes: 0

Brian Gleeson - IBM
Brian Gleeson - IBM

Reputation: 2565

You could use a beanValuePicker data provider, and pull in the data from the two different databases in your managed bean, if you are comfortable working in java. Create a Java class that implements IValuePickerData. See here and here for info on creating a managed bean data provider.

Or you may be able to use a simpleValuePicker data provider, and in the valueList property use SSJS to pull the data in from your two sources.

Otherwise as a work-around/hack-around, the namePicker control has a data provider available to it called namePickerAggregator that allows you to define multiple data providers to be shown in the picker, including using data from different databases. But there's no such provider for a valuePicker. If you were willing to accept the slightly different UI that comes with a name picker versus a value picker, then use the namePickerAggregator with two dominoViewValuePicker data providers. Something like this:

<xe:namePicker id="myPicker" for="inputText1">
    <xe:this.dataProvider>
        <xe:namePickerAggregator>
            <xe:this.dataProviders>
                <xe:dominoViewNamePicker databaseName="database1.nsf" viewName="AllNames" labelColumn="Name" label="Database1"></xe:dominoViewNamePicker>
                <xe:dominoViewNamePicker databaseName="database2.nsf" viewName="AllNames" labelColumn="Name" label="Database2"></xe:dominoViewNamePicker>
            </xe:this.dataProviders>
        </xe:namePickerAggregator>
    </xe:this.dataProvider>
</xe:namePicker>

Upvotes: 2

Related Questions