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

30110Re: [ydn-javascript] Re: DataTable pagination issue (YUI version 2.5.0)

Expand Messages
  • Satyam
    May 1, 2008
      Actually, you might do worse by taking those quotes out. If you include the
      json component, the DataSource will use it and that one does expect the
      property names to be enclosed in quotes, which is what the standard says.
      If you don't include YUI's JSON component, the original parser in the
      DataSource will tolerate those absent quotes.

      Satyam



      ----- Original Message -----
      From: "bretlevy" <bret@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Thursday, May 01, 2008 6:05 PM
      Subject: [ydn-javascript] Re: DataTable pagination issue (YUI version 2.5.0)


      >
      > Amir:
      >
      > Can you try taking the quotes off the object literals in your
      > returned JSON? You said you return this:
      >
      > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
      > "dir":"asc"","records":[{"status":"1",...
      >
      > Try:
      >
      > {recordsReturned:300,totalRecords:5222,startIndex:0,sort:null,dir:"asc
      > ",records:[{status:"1",...
      >
      > I also notice you have an extra quote (") after the "asc" value.
      > This might solve your problem.
      >
      > Hope it helps...
      >
      > ~~bret
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "amirlaher" <amirlaher@...>
      > wrote:
      >>
      >> Hi there,
      >>
      >> The DataTable is a beautiful thing, but I've had one issue with
      > it...
      >>
      >> I've got serverside pagination working, but for some reason the
      >> totalRecords wasn't being recognised without a hack. For some reason
      >> it uses the recordsReturned value in place of totalRecords.
      >>
      >> ::: My responseSchema looks like this:
      >> SENRO.clientsearch.myDataSource.responseSchema = {
      >> resultsList: 'records',
      >> fields: getResponseSchemaFields
      > (SENRO.clientsearch.columnDefs),
      >> metaFields : {
      >> totalRecords: 'totalRecords',
      >> paginationRecordOffset : "startIndex"
      >> }
      >> };
      >>
      >> ::: My server's JSON results look like this:
      >>
      > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
      > "dir":"asc"","records":[{"status":"1",
      >> ....
      >> }
      >>
      >> ** My config looks like this
      >> SENRO.clientsearch.configs = {
      >> initialRequest : initRequest,
      >> generateRequest :
      > SENRO.clientsearch.buildQueryString,
      >> paginator: new YAHOO.widget.Paginator
      > ({
      >> rowsPerPage : 20,
      >> template: "{FirstPageLink}
      > {PreviousPageLink} {PageLinks}
      >> {NextPageLink} {LastPageLink} {CurrentPageReport}",
      >> pageReportTemplate : "Showing
      > items {startIndex} - {endIndex} of
      >> {totalRecords}",
      >> totalRecords:
      > SENRO.clientsearch.resultcount,
      >>
      >> }),
      >> renderLoopSize : 20,
      >> scrollable: false,
      >> paginated: true,
      >> // paginationEventHandler :
      >> SENRO.clientsearch.handlePagination,
      >> paginationEventHandler :
      >> YAHOO.widget.DataTable.handleDataSourcePagination,
      >> recordOffset: 0
      >> };
      >>
      >> I haven't posted the whole of the code because it's not for public
      >> consumption, let me know if you need more info.
      >>
      >> The hack I used to fix it was to store the totalRecords amount
      >> separately in the page, and hack together a different
      >> paginationEventHandler.
      >> I copied and pasted the handleSimplePagination and
      >> handleDataSourcePagination functions straight out of
      >> datatable-beta-debug.js, and hard-coded the totalRecords value into
      > my
      >> modified handleSimplePagination function.
      >>
      >> I can live with this, but it's not ideal. I can't really figure out
      >> what's wrong with my setup that it's not taking note of my
      >> totalRecords value. Is this a known issue?
      >>
      >> Cheers,
      >>
      >> Amir
      >>
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG.
      > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
      > 30/04/2008 18:10
      >
      >
    • Show all 10 messages in this topic