1
votes

i got a simple code sniped to jump to a specific entry in a viewPanel control

var c:com.ibm.xsp.component.xp.XspViewPanel = getComponent("viewPanel1");       
var ds:com.ibm.xsp.model.domino.DominoViewData = c.getDataSource(); 
ds.setStartKeys(MYVALUETOSEARCH);
c.gotoRow(c.getRowIndex()); 

This works perferct when the sorted column is a string but it did not work when the column is a date.

It seems it is not allowed to pass MYVALUETOSEARCH as NotesDateTime Any Ideas to solve the problem?

EDIT: I use Domino 9.0.1 FP7

Here is the complete sample

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:inputText
    id="filter">
    <xp:dateTimeHelper
        id="dateTimeHelper1"></xp:dateTimeHelper>
    <xp:this.converter>
        <xp:convertDateTime
            type="date"></xp:convertDateTime>
    </xp:this.converter>
</xp:inputText>

<xp:button
    value="Label"
    id="button1">
    <xp:eventHandler
        event="onclick"
        submit="true"
        refreshMode="partial"
        refreshId="viewPanel1">
        <xp:this.action><![CDATA[#{javascript:var c:com.ibm.xsp.component.xp.XspViewPanel = getComponent("viewPanel1");       
                var ds:com.ibm.xsp.model.domino.DominoViewData = c.getDataSource(); 
                var filter = getComponent("filter").getValue();
                var dt:NotesDateTime = session.createDateTime(filter);
                ds.setStartKeys(dt);
                ds.refresh();}]]>
        </xp:this.action>
    </xp:eventHandler>
</xp:button>

<xp:viewPanel
    rows="30"
    id="viewPanel1"
    viewStyle="width:100%">
    <xp:this.facets>
        <xp:pager
            partialRefresh="true"
            layout="Previous Group Next"
            xp:key="headerPager"
            id="pager1">
        </xp:pager>
    </xp:this.facets>
    <xp:this.data>
        <xp:dominoView
            var="view1"
            viewName="test">
        </xp:dominoView>
    </xp:this.data>
    <xp:viewColumn
        columnName="date"
        id="viewColumn1">
        <xp:this.converter>
            <xp:convertDateTime
                type="date"></xp:convertDateTime>
        </xp:this.converter>
        <xp:viewColumnHeader
            value="date"
            id="viewColumnHeader1">
        </xp:viewColumnHeader>
    </xp:viewColumn>
</xp:viewPanel>

The view "test" just contains 1 sorted column that contains a date value

1

1 Answers

0
votes

Providing NotesDateTime start key for the ViewPanel would work fine if you make sure the key is of NotesDateTime type. Using component value as a key without converter may give you String instead of expected NotesDateTime value. The following code works in my 9.0.1 environment:

var c:com.ibm.xsp.component.xp.XspViewPanel = getComponent("viewPanel1");       
var ds:com.ibm.xsp.model.domino.DominoViewData = c.getDataSource(); 
var filter = viewScope.get("date");
var dt:NotesDateTime = session.createDateTime(filter);
ds.setStartKeys(dt);
ds.refresh();