1

I do not know that the question is right? Please do not take it your mind if it is crazy. Actually I am working on xpages application. There I need to do two things, that I want to add the picklist functionality and binding the dynamic data like field_1,field_2,field_3, ... upto n depands on customer choice.I am using the composite data for both custom controls. I can remove the picklist control's composite data and also I can do it by passing the scope variables. But that takes more time than the composite data.

I did not get any error. But the binded documents is not saving.

Is it possible to import the CCs that are having composite Data?

Code for first CC:-

<xc:viewpicklist datasrc="view1" dialogID="dialog1" dialogWidth="700px" dialogTitle="Pick this field value!!!">
<xc:this.viewColumn>
<xp:value>0</xp:value>
<xp:value>1</xp:value>
<xp:value>2</xp:value>
</xc:this.viewColumn>
</xc:viewpicklist>

Code for Second CC:-

<xc:BOM_Partinfo BOM_Partinfo="#{document1}"
                               TNUM="field#{index+1}" Desc="Desc#{index+1}" quan="Ea#{index+1}"
                               exp="exp#{index+1}" cap="cap#{index+1}" total="price#{index+1}"
                               RD="RD#{index+1}" m="manufact#{index+1}"
                               m_n="manufactnum#{index+1}">
                       </xc:BOM_Partinfo>
Ramkumar
  • 874
  • 11
  • 27

3 Answers3

1

You cannot send a document data source to a custom control using composite data parameters.

You can try and use this script instead http://openntf.org/XSnippets.nsf/snippet.xsp?id=access-datasources-of-custom-controls

Thomas Adrian
  • 3,543
  • 6
  • 32
  • 62
1

You can read information that is set in the properties of a custom control if it was static in the calling page:

var x = getComponent("yourcomponentid");
x.getPropertyMap().get("parametername");

but you want to propagate a data source from the outer control to the inner control...

You need to plan carefully. If you hand over the data source, then your custom control is dependent on a fixed set of fields in the data source (that would be a parameter of type com.ibm.xsp.model.DocumentDataSource). This would violate the encapsulation principles. So I would recommend you actually hand over data bindings - the advantage: you are very flexible what to bind to (not only data sources, but also beans and scope variables would work then). The trick is you provide the binding name as you would statically type it in (e.g. "document1.subject" or "requestScope.bla" ). In your control you then do

${"#{compositeData.field1}"} 
${"#{compositeData.field2}"} 

You need one for each field.

stwissel
  • 20,110
  • 6
  • 54
  • 101
1

Define data source in XP/CC where you want those CCs. Define parameter "dataSourceName" for both CCs. Inside each of them use EL "requestScope[compositeData.dataSourceName].fieldName" everywhere you want to bind to datasource.

Frantisek Kossuth
  • 3,524
  • 2
  • 23
  • 42