On my XPage, I have a series of search filters (State, First Name and Last Name). The search button triggers the population of the datatable which is bound to a Managed Bean.
The datatable initially gets populated with rows of data. However when I click on Next (in the pager), instead of loading the next 5 rows, it returns no more data. I KNOW the datatable is getting the right number of rows because if I change the Repeat limit in the datatable to 10, they all display. Also, the number of pages in the pager is 2 (which is the correct number).
Any ideas what could be causing this?
Thanks,
Dan
Code for the datatable:
<xp:dataTable rows="5" id="studentTable" var="currentStudent"
style="width:400.0px" value="#{studentlist.students}">
<xp:column id="firstnameColumn" style="font-weight:bold">
<xp:this.facets>
<xp:span xp:key="header">
<xp:span style="font-weight:bold">
First Name
</xp:span>
</xp:span>
</xp:this.facets>
<xp:text escape="true" id="firstnameField"
value="#{currentStudent.firstname}">
</xp:text>
</xp:column>
<xp:column id="column1">
<xp:text escape="true" id="middleinitialField"
value="#{currentStudent.middleName}">
</xp:text>
<xp:this.facets>
<xp:span xp:key="header">
<xp:span style="font-weight:bold">
Middle Name
</xp:span>
</xp:span>
</xp:this.facets>
</xp:column>
<xp:column id="lastnameColumn" style="font-weight:bold">
<xp:this.facets>
<xp:span xp:key="header">
<xp:span style="font-weight:bold">
Last Name
</xp:span>
</xp:span>
</xp:this.facets>
<xp:text escape="true" id="lastnameField"
value="#{currentStudent.lastname}">
</xp:text>
</xp:column>
<xp:column id="idColumn">
<xp:this.facets>
<xp:span xp:key="header">
<xp:span style="font-weight:bold">ID</xp:span>
</xp:span>
</xp:this.facets>
<xp:text escape="true" id="computedField1"
value="#{currentStudent.id}">
</xp:text>
</xp:column>
<xp:this.facets>
<xp:pager layout="Previous Group Next" xp:key="header"
id="pager1" for="studentTable" partialRefresh="true">
</xp:pager>
</xp:this.facets></xp:dataTable>
Code behind the button:
var state=getComponentValue('state');
var firstName=document1.getItemValueString("firstName");
var lastName=document1.getItemValueString("lastName");
if(state == "--" || firstName == "" || lastName == "")
{
//do nothing
}
else{
studentlist.setConnDB("jdbc:sqlserver://XX.XX.X.XX:1433;DatabaseName=dan_test");
studentlist.setConnUserName("test");
studentlist.setConnPassword("Password1");
studentlist.setSQLQuery("SELECT FirstName,MiddleName,LastName,ID FROM TestStudents WHERE FirstName Like '"+firstName+"%' AND LastName Like '"+lastName+"%' AND State = '"+state+"' ORDER BY LastName ASC");