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

DataSource - doBeforeParse - determine the data shouldnt be parsed?

Expand Messages
  • mathew.rowley
    I have a case where I am overriding doBeforeParse for a DataSource. If the DataSource that is returned is determined to be an error, I do not want to parse
    Message 1 of 2 , Feb 29, 2008
    • 0 Attachment
      I have a case where I am overriding 'doBeforeParse' for a DataSource.
      If the DataSource that is returned is determined to be an error, I do
      not want to parse the DataSouce any further (and in turn not return
      anything to the DataTable).

      What is the best way to handle this situation? I was going to return
      null from 'doBeforeParse' but it throws a js error.

      Any ideas? Thanks.
    • Satyam
      I understand that you want to handle the error in doBeforeParse and don t generate the error in the DataTable. The problem is that the DataTable is going to
      Message 2 of 2 , Feb 29, 2008
      • 0 Attachment
        I understand that you want to handle the error in doBeforeParse and don't
        generate the error in the DataTable. The problem is that the DataTable is
        going to show some status, you can't avoid that. The DataTable has to
        either show at least one record, show a sign saying that there are no
        records or that there has been an error, you can't prevent it from saying
        something.

        To have it show the "no records" sign, instead of a null return something
        that the DataSource will parse into a valid empty recordset. For example,
        if you set the DataSource to read JSON data and gave a resultsList of
        'result', do:

        return {result:[]};

        The other alternative is for you to change the messages to be displayed.
        Though they are supposedly stored in constants, JavaScript doesn't have
        constants so set the error message to anything you want and let it display
        that. Finally, another option is, let it display whatever you want, but
        hide the DataTable itself so it won't matter.

        Satyam



        ----- Original Message -----
        From: "mathew.rowley" <mathew.rowley@...>
        To: <ydn-javascript@yahoogroups.com>
        Sent: Friday, February 29, 2008 10:36 PM
        Subject: [ydn-javascript] DataSource - doBeforeParse - determine the data
        shouldnt be parsed?


        >I have a case where I am overriding 'doBeforeParse' for a DataSource.
        > If the DataSource that is returned is determined to be an error, I do
        > not want to parse the DataSouce any further (and in turn not return
        > anything to the DataTable).
        >
        > What is the best way to handle this situation? I was going to return
        > null from 'doBeforeParse' but it throws a js error.
        >
        > Any ideas? Thanks.
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        > --
        > No virus found in this incoming message.
        > Checked by AVG Free Edition.
        > Version: 7.5.516 / Virus Database: 269.21.1/1303 - Release Date:
        > 28/02/2008 12:14
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.