Mar 1, 2016, 3:02 AM
67 Posts

xp:checkBox Data Binding in Repeat Control

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 2

Hi,

cause of bad rendering of xp:checkboxgroup (in tables...) my plan is to render normal checkboxes within a Repeat Control. Every checkbox should bind to an own item (in Postsave i will put them together in one item).

 

first loop:

<xp:checkBox value="#{docVG.Feat1}" .....></xp:checkBox>

second loop:

<xp:checkBox value="#{docVG.Feat2}" .....></xp:checkBox>

... and so on

 

The document 'docVG' is defined as data source and available at that place.

I don't know how to achieve data binding via EL within repeat control. Who has the answer ?

 

Thanks

Uwe

Mar 1, 2016, 3:18 PM
67 Posts
a try to solve it, but ...

i've tried to build EL expression out of strings within the repeat control.

...

<xp:this.value>
     <![CDATA[#{javascript:
         return '#{docVG.Feat' + lnr + '}';
      }]]>
</xp:this.value>

.....

But:

The rendered checkboxes are 'Readonly' and not clickable :-(( 

It is not clear how to achieve the individual data binding for each checkbox.

The complete Control looks like this:

<ul>

<xp:repeat id="repeat1" rows="10" value="#{viewFPbx1}" repeatControls="false" var="col" indexVar="lnr" disableOutputTag="true">
    <xp:checkBox uncheckedValue="">
        <xp:this.text>
             <![CDATA[#{javascript:
             col.getColumnValue("Subject");
             }]]>
         </xp:this.text>
        <xp:this.value>
             <![CDATA[#{javascript:
             return '#{docVG.Feat' + lnr + '}';
             }]]>
         </xp:this.value>
        <xp:this.checkedValue>
             <![CDATA[#{javascript:
             col.getColumnValue("Alias");
             }]]>
         </xp:this.checkedValue>
         <xp:this.defaultChecked>
             <![CDATA[#{javascript:
             col.getColumnValue("initial");                                   
             }]]>
         </xp:this.defaultChecked>
    </xp:checkBox>
    </li>
</xp:repeat> 

</ul>           

May 13, 2016, 12:14 PM
94 Posts
check your data definition for the checkboxes

Make sure they are set to Compute on Page Load, not Compute Dynamically.  Also the Repeat control must be checked to Create Controls at Page Creation.