1

I have an xpage that contains a repeat control. The repeat generates dynamic editable fields based on values in a view. I would like the repeat to grab the data only once so that subsequent updates to the view are not received by the repeat control.

From what I understand of repeat controls this might not be possible.

Is there anyway I would be able to do this?

For what its worth here is the code sample.

<xp:repeat id="repeat2" rows="100" value="#{view6}" indexVar="rowData" var="dataCol" repeatControls="false">
    <xp:tr>
        <xp:td style="width:400px">
            <xc:dynamicChecklistItem
                itemname="#{javascript:rowData+'itemname'}"
                savedname="#javascript:rowData+'savedname'}">
            </xc:dynamicChecklistItem>
        </xp:td>
        <xp:td>
            <xc:dynamicCompleted
                completedField="#{javascript:rowData+'completed'}">
            </xc:dynamicCompleted>
        </xp:td>
        <xp:td>
            <xc:dynamicVerified
                verifiedField="#{javascript:rowData+'verified'}">
            </xc:dynamicVerified>
        </xp:td>
        <xp:td>
            <xc:dynamicComments dsn="document1"
                fieldName="#{javascript:rowData+'Comments'}">
            </xc:dynamicComments>
        </xp:td>
    </xp:tr>
</xp:repeat>
4

1 回答 1

1

You can set dominoView's property dataCache="full". This would save all view entry column values at first request and restore and use them at following requests without going back to view.

For advantages and disadvantages look at page 32 here.

<xp:this.data>
    <xp:dominoView
        var="view6"
        viewName="yourView"
        dataCache="full">
    </xp:dominoView>
</xp:this.data>

As an alternative, you can save the values you need from view in a viewScope variable and use it in repeat control.

<xp:this.beforePageLoad><![CDATA[#{javascript:
    if (viewScope.list == null) {   
        var view = database.getView("yourView");
        var allEntries = view.getAllEntries();
        var list = new Array();
        var entry = allEntries.getFirstEntry();
        for (var i = 0; i < allEntries.getCount(); i++) {
            var columnValues = entry.getColumnValues();
            var items = [columnValues.get(0).toString(), columnValues.get(1).toString()];
            list.push(items);
            entry = allEntries.getNextEntry();
        }
        viewScope.list = list}
    }]]>
</xp:this.beforePageLoad>
<xp:repeat
    id="repeat1"
    rows="100"
    value="#{viewScope.list}"
    indexVar="index"
    var="listElement">
    <xp:text
        id="computedField1"
        value="#{listElement[0]}">
    </xp:text>
    <xp:br />
</xp:repeat>

(You would have to add recycling of Notes objects to code.)

于 2013-09-14T12:19:58.000 回答