Teamstudio Unplugged:内联编辑

时间:2014-05-21 10:34:21

标签: xpages teamstudio-unplugged

我正在使用teamstudio的插头进行录音。

我尝试使用带有视图作为数据源的重复控件来构建表。 用户应该能够更改编辑文档,然后保存所有数据源。

以下是目前无效的示例。 我还尝试使用计算ID来处理单元格中的所有不同复选框 将行文档的UNID存储在隐藏文本字段中,然后根据计算出的ID读取每一行并保存它们。这是行不通的,因为尽管付出了很多努力,但在中继器中计算ID是不可能的。

如果我做错了什么或有一个我没有尝试的伎俩,我很乐意听到它。

<xp:table id="table">
                <xp:tr>
                    <xp:td>Document name</xp:td>
                    <xp:td>Field1</xp:td>
                    <xp:td>Field2</xp:td>
                    <xp:td>Field3</xp:td>
                </xp:tr>
                <xp:repeat id="repeat1" rows="30"
                    value="#{TestDocs}" indexVar="index" var="Docs" first="0"
                    removeRepeat="true" repeatControls="true">
                    <xp:panel>

                        <xp:tr>
                            <xp:td>
                                <xp:text id="Name" escape="true"
                                    value="#{document1.Name}">
                                </xp:text>
                            </xp:td>
                            <xp:td>
                                <xp:checkBox id="Field1"
                                    checkedValue="true" uncheckedValue="false"
                                    value="#{document1.Field1}">
                                    <xp:this.defaultChecked><![CDATA[${javascript: 

if(document1.getDocument().getItemValue("Field1")=="[true]"){               
 return true;
  }else{
 return false;
 }}]]></xp:this.defaultChecked>


                                </xp:checkBox>
                            </xp:td>
                            <xp:td>
                                <xp:checkBox id="Field2"
                                    checkedValue="true" uncheckedValue="false"
                                    value="#{document1.Field2}">
                                    <xp:this.defaultChecked><![CDATA[${javascript: 

 if(document1.getDocument().getItemValue("Field2")=="[true]"){              
 return true;
 }else{
 return false;
 }}]]></xp:this.defaultChecked>


                                </xp:checkBox>
                            </xp:td>
                            <xp:td>
                                    <xp:checkBox id="Field3"
                                    checkedValue="true" uncheckedValue="false"
                                    value="#{document1.Field3}">
                                    <xp:this.defaultChecked><![CDATA[${javascript: 

 if(document1.getDocument().getItemValue("Field3")=="[true]"){              
 return true;
 }else{
 return false;
 }}]]></xp:this.defaultChecked>


                                </xp:checkBox>
                            </xp:td>

                        </xp:tr>
                    </xp:panel>
                </xp:repeat>
            </xp:table>
            <xp:button value="Save" id="button3"
                styleClass="button">

                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="complete" disableValidators="true">
                    <xp:this.action>
                        <xp:save></xp:save>
                    </xp:this.action>
                </xp:eventHandler>
            </xp:button>

1 个答案:

答案 0 :(得分:0)

我倾向于为所有客户端移动逻辑。因此,使用jQuery构建表,然后在保存时,从您创建的字段中取出值,并将它们写入实际保存的隐藏字段中。

在计算字段ID等方面,我会向你想要使用的元素添加属性,然后使用jQuery选择它们:

$('[myattr="the value"]')