具有复合数据的自定义控件中的富文本字段

时间:2016-10-10 18:38:41

标签: xpages lotus-notes lotus-domino

我正在开发一个xpages应用程序并使用1个自定义控件,其中有一个富文本字段。 源文档位于主页面上。 富文本字段通过compositeData赋予它值。 我传递了文档和字段名称。 在CC中,我将富文本字段称为 compositeData.DataSource [compositeData.Fieldname] DataSource我的document1是哪里,Fieldname是notes文档中富文本字段的名称。

除了在富文本中插入图像和删除附件外,所有工作都有效。

我确实找到了很多关于此的信息,但不是真正的解决方案。 Dit有人找到了解决方案吗?

此致

彼得

以下是代码:

自定义控制

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">
    <xp:panel>
        <xp:label id="label1" value="Title:"></xp:label>
        <xp:inputText id="inputText1">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Title]}]]></xp:this.value>
        </xp:inputText>
        <xp:br></xp:br>

        <xp:inputRichText id="richtext">
        <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value></xp:inputRichText>
        <xp:fileUpload id="fileUpload1">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value>
        </xp:fileUpload>

        <xp:fileDownload rows="30" id="fileDownload1"
            displayLastModified="false" allowDelete="true">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value>
        </xp:fileDownload>

    </xp:panel>

</xp:view>

使用CC的XPAGE

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
    xmlns:xe="http://www.ibm.com/xsp/coreex">

    <xp:this.data>
        <xp:dominoDocument var="document1" formName="testform"></xp:dominoDocument>
    </xp:this.data>
    <xe:applicationLayout id="applicationLayout1">
        <xp:panel>
            <xp:button id="button1">
                <xp:this.value><![CDATA[Save & Close]]></xp:this.value>
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="complete">
                    <xp:this.action>
                        <xp:actionGroup>
                            <xp:saveDocument var="document1"></xp:saveDocument>
                            <xp:openPage name="$$PreviousPage"></xp:openPage>
                        </xp:actionGroup>
                    </xp:this.action>
                </xp:eventHandler>
            </xp:button>
            <xp:br></xp:br>
            <xc:cc DataSource="#{javascript:document1}" Field="Body" Title="Title">
            </xc:cc>
        </xp:panel>
        <xe:this.configuration>
            <xe:bootstrapResponsiveConfiguration></xe:bootstrapResponsiveConfiguration>
        </xe:this.configuration>
    </xe:applicationLayout>

    <xp:this.navigationRules>
        <xp:navigationRule outcome="xsp-success" viewId="$$PreviousPage"></xp:navigationRule>
    </xp:this.navigationRules>
</xp:view>

1 个答案:

答案 0 :(得分:0)

我在自定义控件中使用以下内容。请注意,我对xp:inputRichText的value参数使用与上传和下载控件不同的语法 - 并且value参数是在页面加载($)而不是动态(#)上计算的:

    <xp:inputRichText id="richtext" value="${javascript:'#{document.' + compositeData.fieldName + '}';}"></xp:inputRichText>

    <xp:fileUpload id="fileUpload" value="#{document[compositeData.fieldName]}"></xp:fileUpload>

    <xp:fileDownload id="fileDownload" value="#{document[compositeData.fieldName]}"></xp:fileDownload>