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

44578Re: [ydn-javascript] Re: Customizing the First Row

Expand Messages
  • Satyam
    Feb 2, 2009
      The built-in doBeforeCallback simply returns its third argument
      untouched. That argument is an object containing, hopefully, a
      'results' property which will have an array of objects with your data,
      otherwise it will have an 'error' property. You can freely change the
      'results' array, adding records, if you want, or modifying them in any
      way you want. Whatever you return will be what the DataTable gets.

      I am not sure how you would have to manipulate the meta-data, specially
      the number of records received and the total number of records. You
      would also need to ask the server for one record less so that you can
      add your own to its response and still make the right number. I'm not
      that good with the paginator as to suggest you an alternative (if you
      had mentioned you were using the paginator, I wouldn't have replied),
      but it seems to me that going all the way to the DataSource is a little
      too much. I would try to investigate alternatives at the DataTable
      level, checking other events that might trigger when you change pages
      and adding a row then. renderEvent triggers for any refresh of the UI,
      including sorting per column, which might be too much. dataReturnEvent
      might also serve.

      Satyam


      jonathanx37 wrote:
      > I don't think this will work through server side pagination when I
      > click for next results.
      >
      > What would be the pseudo-code for going about it in the method i
      > mentioned above in a doBeforeCallBack fashion?
      >
      > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
      >
      >> It might be easier if you listen to initEvent and use addRow to insert
      >> the row wherever you want it.
      >>
      >> myDataTable.on('initEvent',function() {
      >> this.addRow({ /* object containing initial values for each field */
      >> },0);
      >> });
      >>
      >> Satyam
      >>
      >>
      >> jonathanx37 wrote:
      >>
      >>> I would like to customize the first row with my own data.
      >>>
      >>> Basically, datasource retrieves the info remotely, I would like to use
      >>> doBeforeCallback or doBeforeParseData to insert a row at index 0.
      >>>
      >>> How should I go about it?
      >>>
      >>>
      >>>
      >>>
      >>> ------------------------------------
      >>>
      >>> Yahoo! Groups Links
      >>>
      >>>
      >>>
      >>>
      >>>
      > ------------------------------------------------------------------------
      >
      >>> No virus found in this incoming message.
      >>> Checked by AVG - www.avg.com
      >>> Version: 8.0.233 / Virus Database: 270.10.16/1929 - Release Date:
      >>>
      > 01/31/09 20:03:00
      >
      >>>
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.0.233 / Virus Database: 270.10.16/1929 - Release Date: 01/31/09 20:03:00
      >
      >
    • Show all 9 messages in this topic