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

Re: [ydn-javascript] Re: sendRequest does not update the datatable content

Expand Messages
  • Satyam
    In the previous case you were assigning a reference to the method onDataReturnInitializeTable to let the sendRequest method call it when needed. When you have
    Message 1 of 4 , Jul 29, 2009
    • 0 Attachment
      In the previous case you were assigning a reference to the method
      onDataReturnInitializeTable to let the sendRequest method call it when
      needed. When you have the same reference within an external function
      you actually have to call it, just a reference won't do:

      var dataTableCB = function() {
      AddDataTable.onDataReturnInitializeTable.apply(AddDataTable,arguments);
      };

      Empty parentheses won't work either, you need to pass it the arguments
      that it would have normally passed it, whatever they are. Adjusting the
      scope via the apply method of Function is not strictly needed, it is
      simply because apply takes an array such as arguments and expands it
      into individual arguments in the called function. Since apply needs a
      scope as the first argument, I give it to it. If you know the actual
      number of arguments received by dataTableCd, you can do away with apply
      and simply pass them one by one.

      Satyam


      sdancer75 escribió:
      > Another problem with sendRequest.
      >
      > If I change the original code that works fine with a function for the success case as you can see below then the AddDataTable.onDataReturnInitializeTable inside the
      > dataTableCB does not working. Am I doing something wrong ?
      >
      >
      > var dataTableCB = function() {
      > AddDataTable.onDataReturnInitializeTable;
      > };
      >
      > // Sends a request to the DataSource for more data
      > var oUpdateTableCallBack = {
      > success :dataTableCB,
      > failure :AddDataTable.onDataReturnInitializeTable,
      > scope :AddDataTable
      > };
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, George Papaioannou <sdancer75@...> wrote:
      >
      >> Ok I found the error.sendRequest should be called like this:
      >> AddDataTable.getDataSource().sendRequest(sqlquery, oUpdateTableCallBack);
      >>
      >> --- Óôéò Ôåô., 29/07/09, ï/ç sdancer75 <sdancer75@...> Ýãñáøå:
      >>
      >> Áðü: sdancer75 <sdancer75@...>
      >> ÈÝìá: [ydn-javascript] sendRequest does not update the datatable content
      >> Ðñïò: ydn-javascript@yahoogroups.com
      >> Çìåñïìçíßá: ÔåôÜñôç, 29 Éïýëéïò 2009, 14:12
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >> Hi,
      >>
      >>
      >>
      >> I have datatable and I want to update its content every time the user clicks on a different date from a calendar object. For this reason I included the following code, inside the calendar event. While the datatable instance is exists and working properly, the content is not updated. What seems to be wrong here ?
      >>
      >>
      >>
      >> var oUpdateTableCallBac k = {
      >>
      >> success :AddDataTable. onDataReturnInit ializeTable,
      >>
      >> failure :AddDataTable. onDataReturnInit ializeTable,
      >>
      >> scope : AddDataTable
      >>
      >> };
      >>
      >>
      >>
      >> var sqlquery = "query=Coupons& type=select& primaryKey= CouponID& whereID=" + nYear + "-" + nMonth + "-" + nDay;
      >>
      >> AddDataTable. myDataSource. sendRequest( sqlquery, oUpdateTableCallBac k);
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >> ___________________________________________________________
      >> ×ñçóéìïðïéåßôå Yahoo!;
      >> ÂáñåèÞêáôå ôá åíï÷ëçôéêÜ ìçíýìáôá (spam); Ôï Yahoo! Mail
      >> äéáèÝôåé ôçí êáëýôåñç äõíáôÞ ðñïóôáóßá êáôÜ ôùí åíï÷ëçôéêþí
      >> ìçíõìÜôùí http://login.yahoo.com/config/mail?.intl=gr
      >>
      >>
      >
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.392 / Virus Database: 270.13.35/2270 - Release Date: 07/29/09 06:12:00
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.