M. Schaetzl
M. Schaetzl

Reputation: 251

Xpages repeat control division by zero

I'm using a repeat control displaying names. The content is displayed proberly, but I needed a pager because there can be more than 30 entries.

As soon as I add a pager for this repeat control and press a button doing a partial refresh on the site I get a "division by zero" error.

Here's my repeat control:

<xp:repeat id="repeat1" rows="30" var="namesList" repeatControls="true" indexVar="rowIndex">
    <xp:table>
        <xp:tr>
           <xp:td>
                <xp:link escape="true" id="Employee">
                    <xp:this.text><![CDATA[#{javascript:namesList.getItemValueString("Employee")}]]></xp:this.text></xp:link>
            </xp:td>
        </xp:tr>
    </xp:table>


<xp:this.value><![CDATA[#{javascript:try {
    var wfDoc:NotesDocument = docApplication.getDocument(true);
    var dcNoAnswer:NotesDocumentCollection = database.createDocumentCollection();
    var count:Integer = 0;

    //Gets all response documents, but only adds those to the document collection, without a valid
    //response to the cycle
    if (wfDoc.getResponses() != null) {
        var dc:NotesDocumentCollection = wfDoc.getResponses();
        var doc:NotesDocument = dc.getFirstDocument();

        while (doc != null) {
            if (doc.getItemValueString("Response") == "") {
                dcNoAnswer.addDocument(doc);
            }
            doc = dc.getNextDocument();
        }       
        dc.recycle();
    }
    docApplication.replaceItemValue("MissingResponsesCount", dcNoAnswer.getCount());

    wfDoc.recycle();
    return dcNoAnswer;  
} catch(e) {
    dBar.error("Show no response repeat control data: " + e);
}}]]></xp:this.value>
</xp:repeat>

And here's my pager:

<xp:pager layout="Previous Group Next" id="pager3" for="repeat1"></xp:pager>

As I said, doing a partial refresh on the site oder panel, I'll get this error:

enter image description here

I've been looking for an error for some time, but I can't see anything wrong here. Did anybody else have such a problem and maybe has a solution?

Upvotes: 0

Views: 172

Answers (2)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15739

You have repeatControls="true" set. That means "create the controls once and never again", so you can't use a pager to navigate, as mentioned here. Remove repeatControls="true" and it will work.

If you look at the stack trace, it will fail on getStart().

Upvotes: 0

Ferry Kranenburg
Ferry Kranenburg

Reputation: 2635

Try adding alwaysCalculateLast="false" to your pager. The repeat control could have 0 values (because of dcNoAnswer) and maybe you have set xsp.repeat.allowZeroRowsPerPage=true in your xsp properties settings.

Upvotes: 0

Related Questions