Search code examples
xpagesxpages-ssjs

How do I properly use a Custom Control's "Datasource Picker editor"?


I'm passing a doc datasource into a Custom Control using a property defintion named docDatasource and set to a datatype com.ibm.xsp.model.domino.DominoDocumentData. Just by chance I stumbled upon an editor type named "Datasource Picker". Sounded promising, so I set it to use for m prop definition.

Upon binding the CC into my Xpage - where my doc DS is defined - I indeed can use the picker to choose my datasource ,just as I had expected. But then building the Xpage code I receive an error saying

The value of the property docDatasource cannot be primitive.

So obviously the datatype and the editor don't go along well. There's no harm done really, but I'm curious to learn what else this editor could be used for.


Solution

  • What to do with name of the data source passed to custom control parameter: retrieve its object by simple binding #{requestScope[compositeData.docDatasource]}.

    That will return your data source and you can use this binding where needed. Or store it inside local variable and use it instead.