Xpages Custom Control ViewPicklist

On May 23, 2011, in domino, lotus, xpages, by Mark Hughes

I have completed my custom control for the Xpages Custom Control contest on Openntf.org.  This is a single or multivalue viewpicklist like in the classic Notes client environment.

Here is the link to the project

Demo and Tutorial video

This custom control  presents a dialog box where you can select values from a view( or view documents) to populate a field or scope.

It works single or multivalue, and comes with a style sheet to make it look like the above dialog.  You have the option to configure just about anything imaginable, if not let me know and i will up date it.  Here is a quick shot of some of the porperties.  There are more depending on your selections.

 

A full list of the properties and definitions can be found with the download.

 

Written instructions and an example test page can show you what you need to get started.  Also check out this NotesIn9 video for a demo and tutorial.

 

12 Responses to Xpages Custom Control ViewPicklist

  1. Steve Smillie says:

    I was writing a Picklist today for an app and was really wishing for a pre-built control for this. Then in my news feed appears your control!!

    So far I have a basic example working in my application. Lots of options and seem to be very flexible for styling it!!!

    I do have a question:
    What if I need to capture multiple columns from the picklist choice to my document?
    I am capturing a “key” value to scope variable now and was thinking I would try to do something with that. Is there a way to have his also run a SSJS function on “select” so I can do some other processing?

    • Mark Hughes says:

      As you said getting the docid or universal id and then getting your values would be the goal.

      I can add post processing on the next version, i had thought of that, but wanted to get this one out. I would guess the best option would be to pass a function to the cc to run on select, then run the function with the docid as the parameter…

      • Mark Hughes says:

        or compute the other values based on the docid or key value and refresh them using the refreshid parameter

    • Mark Hughes says:

      Also i dont know if you noticed you can change the Column on the ‘select ‘property to ‘Field’ and type in the field name you want from that document.

      • Steve Smillie says:

        Yeah, working on something based on refresh. Was thinking the same as you.

        The case I am working on now is just one key and lookup another based on the key so that should work.

        A function to the cc to run on control would be perfect.
        I have another case where I grab a bunch of values as a default for a lot of fields then the user can customize those fields later. The function method would allow me to populate the fields on select easily.

        Thanks for making and sharing this control!!

  2. diego ogniben says:

    Really nice control, thanks for sharing!
    Could i suggest you put something like this:

    in the Design Definition of the cc so that it appears just as a little image in the design of the xpage we put it in?

  3. diego ogniben says:

    Ops, the xml got lost. I meant:

    [?xml version=”1.0″ encoding=”UTF-8″?]
    [xp:view xmlns:xp=”http://www.ibm.com/xsp/core”]
    [xp:image url=”/iconSearch16.png”][/xp:image]
    [/xp:view]

  4. Dwain A Wuerfel says:

    I am just beginning to develop in xPages and trying to understand what is being said and how to best use this great tool. If I am thinking correctly once the selection is made from the view picker and the component is populated I can have the below code run for the ‘onchange’ event of that component.

    getComponent(“component name”).setSubmittedValue(@DbLookup(@DbName(), view,key,fieldname));

    • Mark Hughes says:

      There is a place for a ssjs function as well where you can run on the selection before the refresh.

      Function Getvalues(X){
      getComponent(“component name”).setSubmittedValue(@DbLookup(@DbName(), view , x , fieldname));

      }

      Also check out the latest version you can return e unid so you could do a database.getdocumentbyid(x) and get all the values

      So the you can set that value and refresh a penal or div instead of just a field

  5. Fatih Duranoglu says:

    Hi Mark

    i have problem with Bootstrap Paper theme (Bootswatch.com). viewpicklist screen coming disabled i can not select something.

Leave a Reply

Your email address will not be published. Required fields are marked *