Xpages Binding to edit control in a repeat

冷暖自知 提交于 2019-12-23 12:34:17

问题


I'm a problem understanding how to do dynamic binding to a edit control. The backend from has fields fItem01 fItem02... fPD01 fPD02.. fRQR01 fRQR02.. I can get the values for all the fields but having been able to defined the binding for edit control.

I've read all the posting on this subject but haven't figure out what I'm doing wrong. Also tried using a custom control with a property for the binding but that didn't work either.

Thanks for any help on this Bob

<xp:this.data>
    <xp:dominoView var="view1" viewName="vwMultItem"></xp:dominoView>
</xp:this.data>
<xp:table border="1">
    <xp:tr>
        <xp:td>
            <xp:label value="Title" id="label1"></xp:label>
        </xp:td>
        <!--<xp:td></xp:td>-->
    </xp:tr>
    <xp:repeat id="repeat1" rows="1" value="#{view1}" var="row">
        <xp:panel id="panelDocData">
            <xp:this.data>
                <xp:dominoDocument var="document1"
                    formName="frMultItem" action="editDocument"
                    documentId="#{javascript:row.getNoteID();}">
                </xp:dominoDocument>
            </xp:this.data>
            <xp:repeat id="repeat2" rows="3" var="rowItem" first="0"
                indexVar="indexVar">
                <xp:this.value><![CDATA[#{javascript:new Array("01", "02", "03")}]]></xp:this.value>    
                <xp:tr>
                    <xp:repeat id="repeat3" first="0" rows="2"
                        var="rowName">
                        <xp:this.value><![CDATA[#{javascript:new Array("fItem","fPD")}]]></xp:this.value>
                        <xp:td>
                            <xp:text escape="true" id="computedField1">
                                <xp:this.value><![CDATA[#{javascript:document1.getItemValueString(rowName+rowItem);
                                }]]></xp:this.value> </xp:text>                         
                        </xp:td>
                    </xp:repeat>
                        <xp:td>
                            <xp:inputText id="inputText1"
                                value="#{javascript:'#{document1.fRQR'+'01'+'}'}">
                            </xp:inputText></xp:td>
                </xp:tr>
            </xp:repeat>
        </xp:panel>
    </xp:repeat>
</xp:table>

回答1:


As you know which fields you want to put into the repeat control you can calculate the fieldNames in inner repeat block completely with

javascript:["fItem"+rowItem,"fPD"+rowItem,"fRQR"+rowItem]

and then use them in edit control's value EL #{document1[fieldName]}.

<xp:repeat
    id="repeat2"
    var="rowItem"
    indexVar="indexVar">
    <xp:this.value><![CDATA[#{javascript:["01", "02", "03"]}]]></xp:this.value>
    <xp:tr>
        <xp:repeat
            id="repeat3"
            var="fieldName">
            <xp:this.value><![CDATA[#{javascript:["fItem"+rowItem,"fPD"+rowItem,"fRQR"+rowItem]}]]></xp:this.value>
            <xp:td>
                <xp:inputText
                    id="inputText2"
                    value="#{document1[fieldName]}">
                </xp:inputText>
            </xp:td>
        </xp:repeat>
    </xp:tr>
</xp:repeat>


来源:https://stackoverflow.com/questions/18258246/xpages-binding-to-edit-control-in-a-repeat

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!