Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to bind them dynamically, you can also do this with expression language. It takes a bit of getting around in order to get the fields editable, but the way I've resolved it is to pass a calculated ID into a custom control, then using that for the binding.</p> <p>For example: If I'm Working with a list of Unique Part Names, I may pass into my custom control a variable for a Comment. If I pass this in as fieldNameComment to my custom control, I can dynamically bind it to an inputText element through the following code.</p> <p>I'm using a DominoDocument passed in as the dataSource.</p> <p>Calling the Custom Control:</p> <pre><code>&lt;xp:repeat var="CurrVal" value="#{DataSource}"&gt; &lt;xc:DynamicTableRow dataSource="#{EmissionsDocument}"&gt; &lt;xc:this.fieldNameComment&gt;&lt;![CDATA[#{javascript:CurrVal+"Comment"}]]&gt;&lt;/xc:this.fieldNameComment&gt; &lt;/xc:DynamicTableRow&gt; &lt;/xp:repeat&gt; </code></pre> <p>Inside the Custom Control:</p> <pre><code>&lt;xp:inputText id="inputText5" value="#{compositeData.dataSource[compositeData.fieldNameComment]}"&gt; &lt;/xp:inputText&gt; </code></pre> <p>As long as (for some reason) none of the string calculations are performed within the expression language syntax, this will yield an editable field. In my testing, if I tried to calculate a value by concatenating any strings, the field would be bound, but not appear as editable under any circumstances. If you want to bind directly to fields, this may be a good approach, but if you want to save your array and parse it through java, then Stephan's solution also works great Hope this helps!</p> <p>Appended: Added repeat control to show iteration through the data source. Each iteration of the Data Source yeilds a value, CurrVal, to which the string "Comment" is appended. This creates a series of FieldNames based on the Values in the DataSource that are bound to inputs within the custom control called DynamicTableRow</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload