Xpages 绑定以重复编辑控件 [英] Xpages Binding to edit control in a repeat

查看:37
本文介绍了Xpages 绑定以重复编辑控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在理解如何对编辑控件进行动态绑定时遇到问题.来自后端的字段 fItem01 fItem02... fPD01 fPD02.. fRQR01 fRQR02.. 我可以获得所有字段的值,但能够定义编辑控件的绑定.

我已经阅读了关于这个主题的所有帖子,但还没有弄清楚我做错了什么.还尝试使用带有绑定属性的自定义控件,但这也不起作用.

感谢您对此的任何帮助鲍勃

<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:重复><xp:td><xp:inputText id="inputText1"value="#{javascript:'#{document1.fRQR'+'01'+'}'}"></xp:inputText></xp:td></xp:tr></xp:重复></xp:面板></xp:重复></xp:table>

解决方案

如您知道要放入重复控件的字段,您可以完全使用 <计算内部重复块中的 fieldNames/p>

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

然后在编辑控件的值 EL #{document1[fieldName]} 中使用它们.

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

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>

解决方案

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>

这篇关于Xpages 绑定以重复编辑控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆