Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] using yui-datatable and html markup how to do serverside pagination

Expand Messages
  • Satyam
    You might want to check the following SourceForge post and the file attached to it to base your code in it.
    Message 1 of 2 , Oct 12, 2007
    • 0 Attachment
      You might want to check the following SourceForge post and the file attached
      to it to base your code in it.

      http://sourceforge.net/tracker/index.php?func=detail&aid=1812126&group_id=165715&atid=836476

      Unfortunately, the example has several bugs and any of them might be causing
      you trouble.

      Satyam

      ----- Original Message -----
      From: "den_PHP_Prg" <dennyv2001@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Friday, October 12, 2007 6:33 AM
      Subject: [ydn-javascript] using yui-datatable and html markup how to do
      serverside pagination


      > hi
      > i am trying to do serverside pagination using datatable and an html
      > markup as datasource.
      >
      > But here serverside pagination is not working...Please help
      > here is a part of JS code...rest every thing is same as in the
      > serverside pagination example.
      >
      > var myColumnDefs = [
      > {key:"tickall",label:"<input type=checkbox name=tickall id=tickall
      > value=ON>", sortable:false},
      >
      > {key:"id",label:"ID",formatter:YAHOO.widget.DataTable.formatNumber,sortable:true},
      > {key:"author",label:"Author", sortable:true},
      > {key:"subject",label:"Subject",sortable:true},
      > {key:"date",label:"Date",sortable:true},
      > {key:"followup",label:"Followup",sortable:true},
      > {key:"status",label:"Status",sortable:true},
      > {key:"priority",label:"Priority",sortable:true},
      > {key:"owner",label:"Owner",sortable:true},
      > {key:"options",label:"Options",sortable:false}
      > ];
      >
      > this.myDataSource = new
      > YAHOO.util.DataSource(YAHOO.util.Dom.get("tickets"));
      > this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
      > this.myDataSource.responseSchema = {
      > resultsList: "records",
      > fields: [{key:"tickall"},
      > {key:"id", parser:YAHOO.util.DataSource.parseNumber},
      > {key:"author"},
      > {key:"subject"},
      > {key:"date"},
      > {key:"followup"},
      > {key:"status"},
      > {key:"priority"},
      > {key:"owner"},
      > {key:"options"}
      > ]
      > };
      >
      >
      > // DataTable instance
      > var oConfigs = {
      > initialRequest: "startIndex=0&results=5" // Initial values
      > };
      > this.myDataTable = new YAHOO.widget.DataTable("markup",
      > myColumnDefs, this.myDataSource, oConfigs);
      >
      > // Custom code to parse the raw server data for Paginator
      > values and page links
      > this.myDataSource.doBeforeCallback = function(oRequest,
      > oRawResponse, oParsedResponse) {
      > var oSelf = YAHOO.example.ServerPagination;
      > var oDataTable = oSelf.myDataTable;
      >
      > // Get Paginator values
      > var oRawResponse = oRawResponse;
      > var recordsReturned = oRawResponse.recordsReturned;
      > var startIndex = oRawResponse.startIndex;
      > var endIndex = startIndex + recordsReturned -1;
      > var totalRecords = oRawResponse.totalRecords;
      >
      > console.log(oRawResponse);
      > // Update the DataTable Paginator with new values
      > var newPag = {
      > recordsReturned: recordsReturned,
      > startRecordIndex: startIndex,
      > endIndex: endIndex,
      > totalResults: totalRecords
      > }
      > oDataTable.updatePaginator(newPag);
      >
      > // Update the links UI
      > YAHOO.util.Dom.get("prevLink").innerHTML = (startIndex ===
      > 0) ? "<" :
      > "<a href=\"#previous\" alt=\"Show previous
      > items\"><</a>" ;
      > YAHOO.util.Dom.get("nextLink").innerHTML =
      > (endIndex >= totalRecords) ? ">" :
      > "<a href=\"#next\" alt=\"Show next items\">></a>";
      > YAHOO.util.Dom.get("startIndex").innerHTML = startIndex;
      > YAHOO.util.Dom.get("endIndex").innerHTML = endIndex;
      > YAHOO.util.Dom.get("ofTotal").innerHTML = " of " +
      > totalRecords;
      >
      > // Let the DataSource parse the rest of the response
      > return oParsedResponse;
      > };
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG Free Edition.
      > Version: 7.5.488 / Virus Database: 269.14.8/1064 - Release Date:
      > 11/10/2007 15:09
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.