I have pagnition problem in I am using server side processing

I have pagnition problem in I am using server side processing

SimonshengSimonsheng Posts: 10Questions: 0Answers: 0
edited July 2012 in General
my first page, iDisplayLength=10 and iDisplayStart=0,but second page iDisplayStart=10 and iDisplayLength=10. I don't know ,maybe this is a bug, did we fix it?
Default.asp
[code]
<!DOCTYPE HTML>







$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "newUniqueReportDataAjax.asp"
} );
} );






CREATION DATE
USERNAME
HEADERID
FEESCHEDULENAME
PRODUCT
DEFAULT PERCENT
EFFECTIVE DATE
TERMINATION DATE




Loading data from server




CREATION DATE
USERNAME
HEADERID
FEESCHEDULENAME
PRODUCT
DEFAULT PERCENT
EFFECTIVE DATE
TERMINATION DATE





[/code]
newUniqueReportDataAjax.asp
[code]
<% @language="javascript"%>
<!--#include file="adojavas.inc"-->
<%
var conString = "Provider =" + Application("appProvider") + ";" +
"User ID =" + Application("appOwner") + ";" +
"Password =" + Application("appPassword") + ";" +
"Data Source =" + Application("appDSN") + ";" +
"Persist Security Info=" + Application("appPersistSecurityInfo");
var conn = Server.CreateObject("ADODB.Connection");
var cmd = Server.CreateObject("ADODB.Command");
var rs = Server.CreateObject("ADODB.Recordset");
cmd.CommandText = "{call PKGSCHEDULE_UTIL.spReportNewUNIQUEMulti(?,?,?,?,?,?,?)}";
cmd.CommandType = adCmdText;
var param1 = cmd.CreateParameter("PID_STARTDATE",adDBDate,adParamInput,10,"12-JUL-88");
var param2 = cmd.CreateParameter("PID_ENDDATE",adDBDate,adParamInput,255,"12-JUL-25");
var param3 = cmd.CreateParameter("PIV_SCHEDULECODE",adVarChar,adParamInput,255,null);
var param4 = cmd.CreateParameter("PIV_USERIDS",adVarChar,adParamInput,255,null);
var param5 = cmd.CreateParameter("PG_LENGTH",adBigInt,adParamInput,5000,Request.QueryString("iDisplayLength"));
var param6 = cmd.CreateParameter("PG_Start",adBigInt,adParamInput,5000,Request.QueryString("iDisplayStart"));
var param7 = cmd.CreateParameter("PG_TOTAL",adBigInt,adParamOutput,5000,null);
cmd.Parameters.Append(param1);
cmd.Parameters.Append(param2);
cmd.Parameters.Append(param3);
cmd.Parameters.Append(param4);
cmd.Parameters.Append(param5);
cmd.Parameters.Append(param6);
cmd.Parameters.Append(param7);
conn.Open(conString);
cmd.ActiveConnection = conn;
try{
rs = cmd.Execute();
}catch(e){
Response.Write(e.message);
}
var rsString = '{"sEcho":"'+Request.QueryString("sEcho")+
'","iTotalRecords":"'+cmd.Parameters("PG_TOTAL")+
'","iTotalDisplayRecords":"'+cmd.Parameters("PG_TOTAL")+'","aaData" : [';
while(!rs.EOF){
rsString = rsString + '[';
rsString = rsString + '"' + rs.Fields("CreationDate")+'",'
rsString = rsString + '"' + rs.Fields("CreatedBy")+'",'
rsString = rsString + '"' + rs.Fields("ScheduleCode")+'",'
rsString = rsString + '"' + rs.Fields("ScheduleName")+'",'
rsString = rsString + '"' + rs.Fields("ProductType")+'",'
rsString = rsString + '"' + Request.QueryString("sEcho")+'",'
rsString = rsString + '"' + Request.QueryString("iDisplayLength")+'",'
rsString = rsString + '"' + Request.QueryString("iDisplayStart")+'"'
rsString = rsString + ']';
rs.MoveNext();
if (!rs.EOF)
{
rsString = rsString + ',';
}
}
var rsString = rsString + ']}';
cmd = null;
conn.Close();
conn = null;
Response.Write(rsString);
%>
[/code]
and I got my first page is
[code]
Show 102550100 entriesSearch: Processing...CREATION DATE USERNAME HEADERID FEESCHEDULENAME PRODUCT DEFAULT PERCENT EFFECTIVE DATE TERMINATION DATE
CREATION DATE USERNAME HEADERID FEESCHEDULENAME PRODUCT DEFAULT PERCENT EFFECTIVE DATE TERMINATION DATE
07/12/2012 15:46:26 Simon FSIMONTEST simon data test HMA 1 10 0
07/12/2012 17:26:34 Simon FTT ttt PRIMARY 1 10 0
07/12/2012 17:26:42 Simon FTTT tttt PRIMARY 1 10 0
07/12/2012 17:26:47 Simon FTTTT ttttt PRIMARY 1 10 0
07/12/2012 17:26:51 Simon FTTTTT tttttt PRIMARY 1 10 0
07/12/2012 17:26:57 Simon FTTTTTT ttttttt PRIMARY 1 10 0
07/12/2012 17:27:02 Simon FTTTTTTT tttttttt PRIMARY 1 10 0
07/12/2012 17:27:06 Simon FTTTTTTTT ttttttttt PRIMARY 1 10 0
07/12/2012 17:27:10 Simon FTTTTTTTTT tttttttttt PRIMARY 1 10 0
07/12/2012 17:27:14 Simon FTTTTTTTTTT ttttttttttt PRIMARY 1 10 0

Showing 1 to 10 of 19 entriesPreviousNext
[/code]
but if I click next
[code]
nothing
[/code]
Can anybody help?

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    > iDisplayLength=10 and iDisplayStart=0,but second page iDisplayStart=10 and iDisplayLength=10. I don't know ,maybe this is a bug, did we fix it?

    I don't really understand. iDisplayStart is row number that DataTables is request you start from, i.e. 0 for the first page of 10, 10 for the second page of 10, 20 for the third page of 10 etc.

    iDisplayLength is the number of records to get for the page.

    I don't see a bug there.

    Allan
  • SimonshengSimonsheng Posts: 10Questions: 0Answers: 0
    Sorry, in store procedure, I gave wrong, numrow < iDisplayStart and >= iDisplayLength
    It should be [quote]numrow < iDisplayStart and >= iDisplayStart + iDisplayLength[/quote]
This discussion has been closed.