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

Re: [ydn-javascript] Editable datatable..

Expand Messages
  • Satyam
    It is better that you don t change the original distribution files, I did that once and when the update came, it was tough to check the changes. What I now
    Message 1 of 21 , Sep 3, 2007
    • 0 Attachment
      It is better that you don't change the original distribution files, I did that once and when the update came, it was tough to check the changes. 
       
      What I now have is a separate file with all my patches that I load after the file to be patched so that its definitions overwrite the original ones.  That makes it easy when a new version comes to pick the methods that were patched and check if they are still necesary.
       
      I actually have my own customized version of DataTable (using YAHOO.lang.extend) where I have several of the basic settings already taken care of and I can redefine the methods in that inherited DataTable.  If there were to be any licensing issues with modifying the original library, this would take care of them. 
       
      Anyway, redefining the original or your inherited version makes no difference when update time comes, you'll have to check those patches anyway, so it is good to have them all in one place. 
       
      Satyam
       
      ----- Original Message -----
      Sent: Monday, September 03, 2007 10:05 AM
      Subject: RE: [ydn-javascript] Editable datatable..

      Thanks a lot Satyam….

       

      I have a very basic question here….

      This solution involves changing the yui code.

       

      Is this allowed, I mean are we supposed to give this as a patch and then make use of the new release?

       

      Thanks

      Prasanna

       

       

       


      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Satyam
      Sent: Friday, August 31, 2007 10:38 PM
      To: ydn-javascript@yahoogroups.com
      Subject: Re: [ydn-javascript] Editable datatable..

       

      That is, indeed, a problem.  The best alternative I found is to redefine the saveCellEditor method. 

       

      This is how the original looks like, with the original comments stripped and my own added:

       

      YAHOO.widget. DataTable. prototype. saveCellEditor = function() {

          if(this._oCellEdito r.isActive) {
              var newData = this._oCellEditor. value;
              var oldData = this._oCellEditor. record.getData( this._oCellEdito r.column. key);

       

              if(this._oCellEdito r.validator) {
                  this._oCellEditor. value = this._oCellEditor. validator. call(this, newData, oldData);
                  if(this._oCellEdito r.value === null ) {

              //  -----  This is what you do on error
                      this.resetCellEdito r();
                      this.fireEvent( "editorRevertEve nt",
                              {editor:this. _oCellEditor, oldData:oldData, newData:newData} );
              // ----- up to here
                      return;

                  }
              }

      // ----- This is what you do on success

              this._oRecordSet. updateKey( this._oCellEdito r.record, this._oCellEditor. column.key, this._oCellEditor. value);

              this.formatCell( this._oCellEdito r.cell);

              this.resetCellEdito r();

              this.fireEvent( "editorSaveEvent ",
                      {editor:this. _oCellEditor, oldData:oldData, newData:newData} );

      // ---- up to here.

       


          }
          else {
          }
      };

       

      So, what I did is to have the part that handles a failed validation made into an inner function, since it will be called in several places.  Where the failure secion is I put a call to this inner function.

       

      I cut the 'success' part and save it elsewhere since we are going to use id.  In its place, I put the call to asyncRequest and end the function.  In the success callback to asyncRequest I put the success section I saved. 

       

      On the 'failure' callback to asyncRequest I call the failure function, that's why I put it in an inner function.  Actually, even on a sucess return from the server, you have to check if there was any error from the database since the failure callback only handles communication errors, if there are any logic errors, you have to handle those.  In case of error, I call the failure function.  My own is somewhat different, bits and pieces that I added or deleted from the original so I am making this one right here on the message, cutting and pasting and writing here.  It probably doesn't work as is, but I hope it will give you the general idea.  I tried to preserve as much of the original function as possible, even the comments I put in the one above.

       

      YAHOO.widget. DataTable. prototype. saveCellEditor = function() {

         // ++++ this is the inner function to handle the several possible failure conditions

          var onFailure = function (msg) {

              alert(msg);
              //  -----  This is what you do on error
                 this.resetCellEdito r();
                 this.fireEvent( "editorRevertEve nt",
                              {editor:this. _oCellEditor, oldData:oldData, newData:newData} );

              // ----- up to here
        };

      // +++ this comes from the original exdcept for the part I cut to place in the function above.

          if(this._oCellEdito r.isActive) {
              var newData = this._oCellEditor. value;
              var oldData = this._oCellEditor. record.getData( this._oCellEdito r.column. key);

       

              if(this._oCellEdito r.validator) {
                  this._oCellEditor. value = this._oCellEditor. validator. call(this, newData, oldData);
                  if(this._oCellEdito r.value === null ) {

                      onFailure('validati on');

                      return;

                  }
              }

       

      // ++++++ from here on I added new, except for the 'success' case pasted in.

          YAHOO.util.Connecti on.asyncRequest( 'GET','yourURL with newData,fieldname and primary as arguments ',

              {

                  success: function (o) {

                      if (no error on reply from server) {

                      // ----- This is what you do on success

                          this._oRecordSet. updateKey( this._oCellEdito r.record, this._oCellEditor. column.key, this._oCellEditor. value);

                          this.formatCell( this._oCellEdito r.cell);

                          this.resetCellEdito r();

                          this.fireEvent( "editorSaveEvent ",
                                  {editor:this. _oCellEditor, oldData:oldData, newData:newData} );

                      // ---- up to here.

                  } else {

                      onFailure(o. responseText) ;

              },

              failure: function(o) {

                  onFailure(o. statusText) ;

              },

              scope: this

          );

       


          }
          else {
          }
      };


      In my version I don't close the inline editor on error.  The user has either to fix the error (if it is a validation error, client or server side, he can probably fix it) or cancel out of it. 

       

      I don't fire the editorRevertEvent and editorSaveEvent since I don't listen to them.  I particularly feel the editorSaveEvent fires too late. That is where you would normally hook for the AJAX call to the server, but the DataTable is already changed and the editor closed as if everything was ok and if there is an error, the user might have already navigated away from the page trusting everything was Ok.  Anyhow, moving that event up doesn't help much since, due to the A in AJAX , you cannot wait in the event for an answer, so the whole thing doesn't quite work. 

       

      I also have a Dialog which I use instead of both alert() and confirm(), just for the look and feel. 

       

      I also use a POST request instead of GET to allow for large field contents.

       

       

      Finally, if you are using JSON, I found that using an 'envelope' in the reply makes things more flexible.  My 'envelope' looks like this:

       

      {
          replyCode:200, replyText:"Ok" ,
          data:[{ ... } , ... ]
      }

       

      You could do more or less the same thing with XML.  Whichever the message format, make sure to the reply codes are easy to reach.

       

      The data element is optional and may contain whatever was requested, but sometimes you just want to know whether it succ

      (Message over 64 KB, truncated)

    • Nagasamudram, Prasanna Kumar
      Hi Satyam editor: textbox ,editorOptions:{validator:function(oData){ if (confirm( do you want to save? )) return oData; return null; }} Here oData refers to
      Message 2 of 21 , Sep 4, 2007
      • 0 Attachment

        Hi Satyam

         

        editor:"textbox",editorOptions: {validator: function( oData){
             if (confirm('do you want to save?')) return oData;
             return null;
            }}

         

         

        Here oData refers to the actual data. (of that particular cell).

         

        Is there a way to get the record from this…

         

        I mean I would like to send an Ajax request using the other fields in the row.

         

        Is there something like

         

        record = getRecord(oData)

         

        and then use record.someotherfield etc…

         

         

        Thanks

        Prasanna

         


        From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
        Sent: Tuesday, August 28, 2007 5:44 PM
        To: ydn-javascript@yahoogroups.com
        Subject: Re: [ydn-javascript] Editable datatable..

         

        I'm a little confused, Formatter?  that's used for displaying, I was talking about the validator.. 

         

        Anyway, here is a little sample code that works and I hope will explain itself, just add the following to the column definition of any column you want to have further confirmation before saving:

         

        editor:"textbox",editorOptions: {validator: function( oData){
             if (confirm('do you want to save?')) return oData;
             return null;
            }}

         

        Satyam

         

        ----- Original Message -----

        Sent: Tuesday, August 28, 2007 1:22 PM

        Subject: RE: [ydn-javascript] Editable datatable..

         

        Hi Satyam

         

        I was able to catch the moment when the editor is about to save the data, where I will display a dialog box, which says “do you want to really commit?”, clicking on yes I can call the savecellEditor.

         

        But my problem is say we have the following

         

         

        Formatter

        {

                    callDialog()

                    return something based on the dialog or the flag

        }

         

         

        callDialog()

        {

         

                    handleOK {   saveCellEditor( ) or may be set a flag}

                    handleCANCEL { do Nothing}

         

        }

         

         

        By the time I click on the OK button of the dialog box, Formatter should have done its job of displaying the dialog box, but has nothing to return.

         

         

        Thanks

        Prasanna

         


        From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
        Sent: Friday, August 17, 2007 2:21 PM
        To: ydn-javascript@ yahoogroups. com
        Subject: Re: [ydn-javascript] Editable datatable..

         

        A good place to do this would be to assign a validator function to the columns you will edit such that if the user confirms, you return the received value (first argument, newData) indicating it validated Ok, otherwise, you return null and the validation will fail. 

         

        See the method:

         

        YAHOO.widget. DataTable. prototype. saveCellEditor 

         

        in datatable-beta. js and you will see how it would work. I think it is the least intrusive way to do what you are asking for.  This method is called to save the data for any cell editor, whichever way the user ends the inline editing and the call to:

         

        this._oCellEditor. validator. call(this, newData, oldData);

         

        is a good place to catch the right moment.

         

        Satyam

         

         

         

        ----- Original Message -----

        Sent: Friday, August 17, 2007 10:25 AM

        Subject: [ydn-javascript] Editable datatable..

         

        Hi

         

         

        I have seen the sample that displays a text box when a particular cell in a data table is clicked.

         

        When the uses modifies the text and presses the ENTER key the data is saved and is reflected on the fly.

         

        I want to catch this ENTER key and display a confirmation dialog box , if the user presses OK then I need to call a function before saving the data.

         


        (Message over 64 KB, truncated)

      • Satyam
        Yes: MyDataTable.getCellEditor().record See: http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#getCellEditor There is a lot of information in
        Message 3 of 21 , Sep 4, 2007
        • 0 Attachment
          Yes:
           
          MyDataTable.getCellEditor().record
           
          See:
           
           
          There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.
           
          Satyam
           
          ----- Original Message -----
          Sent: Tuesday, September 04, 2007 9:43 AM
          Subject: RE: [ydn-javascript] Editable datatable..

          Hi Satyam

           

          editor:"textbox",editorOptions: {validator: function( oData){
               if (confirm('do you want to save?')) return oData;
               return null;
              }}

           

           

          Here oData refers to the actual data. (of that particular cell).

           

          Is there a way to get the record from this…

           

          I mean I would like to send an Ajax request using the other fields in the row.

           

          Is there something like

           

          record = getRecord(oData)

           

          and then use record.someotherfield etc…

           

           

          Thanks

          Prasanna

           


          From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
          Sent: Tuesday, August 28, 2007 5:44 PM
          To: ydn-javascript@yahoogroups.com
          Subject: Re: [ydn-javascript] Editable datatable..

           

          I'm a little confused, Formatter?  that's used for displaying, I was talking about the validator.. 

           

          Anyway, here is a little sample code that works and I hope will explain itself, just add the following to the column definition of any column you want to have further confirmation before saving:

           

          editor:"textbox",editorOptions: {validator: function( oData){
               if (confirm('do you want to save?')) return oData;
               return null;
              }}

           

          Satyam

           

          ----- Original Message -----

          Sent: Tuesday, August 28, 2007 1:22 PM

          Subject: RE: [ydn-javascript] Editable datatable..

           

          Hi Satyam

           

          I was able to catch the moment when the editor is about to save the data, where I will display a dialog box, which says “do you want to really commit?”, clicking on yes I can call the savecellEditor.

           

          But my problem is say we have the following

           

           

          Formatter

          {

                      callDialog()

                      return something based on the dialog or the flag

          }

           

           

          callDialog()

          {

           

                      handleOK {   saveCellEditor( ) or may be set a flag}

                      handleCANCEL { do Nothing}

           

          }

           

           

          By the time I click on the OK button of the dialog box, Formatter should have done its job of displaying the dialog box, but has nothing to return.

           

           

          Thanks

          Prasanna

           


          From:ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
          Sent: Friday, August 17, 2007 2:21 PM
          To: ydn-javascript@ yahoogroups. com
          Subject: Re: [ydn-javascript] Editable datatable..

           

          A good place to do this would be to assign a validator function to the columns you will edit such that if the user confirms, you return the received value (first argument, newData) indicating it validated Ok, otherwise, you return null and the validation will fail. 

           

          See the method:

           

          YAHOO.widget. DataTable. prototype. saveCellEditor 

           

          in datatable-beta. js and you will see how it would work. I think it is the least intrusive way to do what you are asking for.  This method is called to save the data for any cell editor, whichever way the user ends the inline editing and the call to:

           

          this._oCellEditor. validator. call(this, newData, oldData);

           

          is a good place to catch the right moment.

           

          Satyam

           

           

           

          ----- Original Message -----

          From:

          (Message over 64 KB, truncated)

        • Nagasamudram, Prasanna Kumar
          Thanks Satyam I would also like to get the column name But for some reason the following is returning null. alert(myDataTable.getCellEditor().column.label);
          Message 4 of 21 , Sep 4, 2007
          • 0 Attachment

            Thanks Satyam

             

            I would also like to get the column name

             

            But for some reason the following is returning null.

             

            alert(myDataTable.getCellEditor().column.label);

             

             

             

            Thanks

            Prasanna


            From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
            Sent: Tuesday, September 04, 2007 1:35 PM
            To: ydn-javascript@yahoogroups.com
            Subject: Re: [ydn-javascript] Editable datatable..

             

            Yes:

             

            MyDataTable. getCellEditor( ).record

             

            See:

             

             

            There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.

             

            Satyam

             

            ----- Original Message -----

            Sent: Tuesday, September 04, 2007 9:43 AM

            Subject: RE: [ydn-javascript] Editable datatable..

             

            Hi Satyam

             

            editor:"textbox",editorOptions: {validator: function( oData){
                 if (confirm('do you want to save?')) return oData;
                 return null;
                }}

             

             

            Here oData refers to the actual data. (of that particular cell).

             

            Is there a way to get the record from this…

             

            I mean I would like to send an Ajax request using the other fields in the row.

             

            Is there something like

             

            record = getRecord(oData)

             

            and then use record.someotherfie ld etc…

             

             

            Thanks

            Prasanna

             


            From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
            Sent: Tuesday, August 28, 2007 5:44 PM
            To: ydn-javascript@ yahoogroups. com
            Subject: Re: [ydn-javascript] Editable datatable..

             

            I'm a little confused, Formatter?  that's used for displaying, I was talking about the validator.. 

             

            Anyway, here is a little sample code that works and I hope will explain itself, just add the following to the column definition of any column you want to have further confirmation before saving:

             

            editor:"textbox",editorOptions: {validator: function( oData){
                 if (confirm('do you want to save?')) return oData;
                 return null;
                }}

             

            Satyam

             

            ----- Original Message -----

            Sent: Tuesday, August 28, 2007 1:22 PM

            Subject: RE: [ydn-javascript] Editable datatable..

             

            Hi Satyam

             

            I was able to catch the moment when the editor is about to save the data, where I will display a dialog box, which says “do you want to really commit?”, clicking on yes I can call the savecellEditor.

             

            But my problem is say we have the following

             

             

            Formatter

            {

                        callDialog()

                        return something based on the dialog or the flag

            }

             

             

            callDialog()

            {

             

                        handleOK {   saveCellEditor( ) or may be set a flag}

                        handleCANCEL { do Nothing}

             

            }

             

             

            By the time I click on the OK button of the dialog box, Formatter should have done its job of displaying the dialog box, but has nothing to return.

             

             

            Thanks

            Prasanna

             


            (Message over 64 KB, truncated)
          • Satyam
            You would probably want the column.key, not the label, which if null defaults to the key. The label is just for the user to see, it might even be in different
            Message 5 of 21 , Sep 4, 2007
            • 0 Attachment
              You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.
               
              Satyam
               
              ----- Original Message -----
              Sent: Tuesday, September 04, 2007 11:17 AM
              Subject: RE: [ydn-javascript] Editable datatable..

              Thanks Satyam

               

              I would also like to get the column name

               

              But for some reason the following is returning null.

               

              alert(myDataTable.getCellEditor().column.label);

               

               

               

              Thanks

              Prasanna


              From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
              Sent: Tuesday, September 04, 2007 1:35 PM
              To: ydn-javascript@yahoogroups.com
              Subject: Re: [ydn-javascript] Editable datatable..

               

              Yes:

               

              MyDataTable. getCellEditor( ).record

               

              See:

               

               

              There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.

               

              Satyam

               

              ----- Original Message -----

              Sent: Tuesday, September 04, 2007 9:43 AM

              Subject: RE: [ydn-javascript] Editable datatable..

               

              Hi Satyam

               

              editor:"textbox",editorOptions: {validator: function( oData){
                   if (confirm('do you want to save?')) return oData;
                   return null;
                  }}

               

               

              Here oData refers to the actual data. (of that particular cell).

               

              Is there a way to get the record from this…

               

              I mean I would like to send an Ajax request using the other fields in the row.

               

              Is there something like

               

              record = getRecord(oData)

               

              and then use record.someotherfie ld etc…

               

               

              Thanks

              Prasanna

               


              From:ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
              Sent: Tuesday, August 28, 2007 5:44 PM
              To: ydn-javascript@ yahoogroups. com
              Subject: Re: [ydn-javascript] Editable datatable..

               

              I'm a little confused, Formatter?  that's used for displaying, I was talking about the validator.. 

               

              Anyway, here is a little sample code that works and I hope will explain itself, just add the following to the column definition of any column you want to have further confirmation before saving:

               

              editor:"textbox",editorOptions: {validator: function( oData){
                   if (confirm('do you want to save?')) return oData;
                   return null;
                  }}

               

              Satyam

               

              ----- Original Message -----

              Sent: Tuesday, August 28, 2007 1:22 PM

              Subject: RE: [ydn-javascript] Editable datatable..

               

              Hi Satyam

               

              I was able to catch the moment when the editor is about to save the data, where I will display a dialog box, which says “do you want to really commit?”, clicking on yes I can call the savecellEditor.

               

              But my problem is say we have the following

               

               

              Formatter

              {

                          callDialog()

                          return something based on the dialog or the flag

              }

               

               

            • Nagasamudram, Prasanna Kumar
              No I want the label.... I want to do something like If (label is aaa ) { sendAjaxrequest(myDataTable.getCellEditor().getData( param1 ), P1 ) } If(label is
              Message 6 of 21 , Sep 4, 2007
              • 0 Attachment

                No I want the label….

                 

                I want to do something like

                 

                If (label is “aaa”)

                {

                            sendAjaxrequest(myDataTable.getCellEditor().getData("param1"), “P1”)

                }

                If(label is “bbb”)

                {

                            sendAjaxrequest(myDataTable.getCellEditor().getData("param1"), “P2”)

                 

                }

                 

                 

                Well I can do this wil the internal column name for example if its column 2 do this else do that.

                 

                But what if I insert another column later….I need to change the above logic again.

                 

                If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                 

                Thanks

                Prasanna

                 


                From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                Sent: Tuesday, September 04, 2007 3:20 PM
                To: ydn-javascript@yahoogroups.com
                Subject: Re: [ydn-javascript] Editable datatable..

                 

                You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.

                 

                Satyam

                 

                ----- Original Message -----

                Sent: Tuesday, September 04, 2007 11:17 AM

                Subject: RE: [ydn-javascript] Editable datatable..

                 

                Thanks Satyam

                 

                I would also like to get the column name

                 

                But for some reason the following is returning null.

                 

                alert(myDataTable. getCellEditor( ).column.label);

                 

                 

                 

                Thanks

                Prasanna


                From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                Sent: Tuesday, September 04, 2007 1:35 PM
                To: ydn-javascript@ yahoogroups. com
                Subject: Re: [ydn-javascript] Editable datatable..

                 

                Yes:

                 

                MyDataTable. getCellEditor( ).record

                 

                See:

                 

                 

                There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.

                 

                Satyam

                 

                ----- Original Message -----

                Sent: Tuesday, September 04, 2007 9:43 AM

                Subject: RE: [ydn-javascript] Editable datatable..

                 

                Hi Satyam

                 

                editor:"textbox",editorOptions: {validator: function( oData){
                     if (confirm('do you want to save?')) return oData;
                     return null;
                    }}

                 

                 

                Here oData refers to the actual data. (of that particular cell).

                 

                Is there a way to get the record from this…

                 

                I mean I would like to send an Ajax request using the other fields in the row.

                 

                Is there something like

                 

                record = getRecord(oData)

                 

                and then use record.someotherfie ld etc…

                 

                 

                Thanks

                Prasanna

                 


                From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                Sent: Tuesday, August 28, 2007 5:44 PM
                To: ydn-javascript@ yahoogroups. com
                Subject: Re: [ydn-javascript] Editable datatable..

                 

                I'm a little confused, Formatter?  that's used for displaying, I was talking about the validator.. 

                 

                Anyway, here is a little sample code that works and I hope will explain itself, just add the following to the column definition of any column you want to have further confirmation before saving:

                 

              • Satyam
                The key is not the ordinal number of the column but the property key: something that you give the columns in the column definitions array and, for lack of
                Message 7 of 21 , Sep 4, 2007
                • 0 Attachment
                  The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.responseSchema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.
                   
                  Satyam
                   
                  ----- Original Message -----
                  Sent: Tuesday, September 04, 2007 12:45 PM
                  Subject: RE: [ydn-javascript] Editable datatable..

                  No I want the label….

                   

                  I want to do something like

                   

                  If (label is “aaa”)

                  {

                              sendAjaxrequest(myDataTable.getCellEditor().getData("param1"), “P1”)

                  }

                  If(label is “bbb”)

                  {

                              sendAjaxrequest(myDataTable.getCellEditor().getData("param1"), “P2”)

                   

                  }

                   

                   

                  Well I can do this wil the internal column name for example if its column 2 do this else do that.

                   

                  But what if I insert another column later….I need to change the above logic again.

                   

                  If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                   

                  Thanks

                  Prasanna

                   


                  From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                  Sent: Tuesday, September 04, 2007 3:20 PM
                  To: ydn-javascript@yahoogroups.com
                  Subject: Re: [ydn-javascript] Editable datatable..

                   

                  You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.

                   

                  Satyam

                   

                  ----- Original Message -----

                  Sent: Tuesday, September 04, 2007 11:17 AM

                  Subject: RE: [ydn-javascript] Editable datatable..

                   

                  Thanks Satyam

                   

                  I would also like to get the column name

                   

                  But for some reason the following is returning null.

                   

                  alert(myDataTable. getCellEditor( ).column.label);

                   

                   

                   

                  Thanks

                  Prasanna


                  From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                  Sent: Tuesday, September 04, 2007 1:35 PM
                  To: ydn-javascript@ yahoogroups. com
                  Subject: Re: [ydn-javascript] Editable datatable..

                   

                  Yes:

                   

                  MyDataTable. getCellEditor( ).record

                   

                  See:

                   

                   

                  There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.

                   

                  Satyam

                   

                  ----- Original Message -----

                  Sent: Tuesday, September 04, 2007 9:43 AM

                  Subject: RE: [ydn-javascript] Editable datatable..

                   

                  Hi Satyam

                   

                  editor:"textbox",editorOptions: {validator: function( oData){
                       if (confirm('do you want to save?')) return oData;
                       return null;
                      }}

                   

                   

                  Here oData refers to the actual data. (of that particular cell).

                   

                  Is there a way to get the record from this…

                   

                  I mean I would like to send an Ajax request using the other fields in the row.

                   

                  Is there something like

                   

                  record = getRecord(oData)

                   

                  and then use record.someotherfie ld etc…

                • Nagasamudram, Prasanna Kumar
                  Hi Satyam I m sorry, please ignore my previous mail.. column.key solves my problem. Thanks a lot.... Prasanna ________________________________ From:
                  Message 8 of 21 , Sep 4, 2007
                  • 0 Attachment

                    Hi Satyam

                     

                    I’m sorry, please ignore my previous mail..

                     

                    column.key solves my problem.

                     

                     

                    Thanks a lot….

                    Prasanna

                     


                    From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                    Sent: Tuesday, September 04, 2007 4:38 PM
                    To: ydn-javascript@yahoogroups.com
                    Subject: Re: [ydn-javascript] Editable datatable..

                     

                    The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.response Schema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.

                     

                    Satyam

                     

                    ----- Original Message -----

                    Sent: Tuesday, September 04, 2007 12:45 PM

                    Subject: RE: [ydn-javascript] Editable datatable..

                     

                    No I want the label….

                     

                    I want to do something like

                     

                    If (label is “aaa”)

                    {

                                sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P1”)

                    }

                    If(label is “bbb”)

                    {

                                sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P2”)

                     

                    }

                     

                     

                    Well I can do this wil the internal column name for example if its column 2 do this else do that.

                     

                    But what if I insert another column later….I need to change the above logic again.

                     

                    If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                     

                    Thanks

                    Prasanna

                     


                    From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                    Sent: Tuesday, September 04, 2007 3:20 PM
                    To: ydn-javascript@ yahoogroups. com
                    Subject: Re: [ydn-javascript] Editable datatable..

                     

                    You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.

                     

                    Satyam

                     

                    ----- Original Message -----

                    Sent: Tuesday, September 04, 2007 11:17 AM

                    Subject: RE: [ydn-javascript] Editable datatable..

                     

                    Thanks Satyam

                     

                    I would also like to get the column name

                     

                    But for some reason the following is returning null.

                     

                    alert(myDataTable. getCellEditor( ).column.label);

                     

                     

                     

                    Thanks

                    Prasanna


                    From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                    Sent: Tuesday, September 04, 2007 1:35 PM
                    To: ydn-javascript@ yahoogroups. com
                    Subject: Re: [ydn-javascript] Editable datatable..

                     

                    Yes:

                     

                    MyDataTable. getCellEditor( ).record

                     

                    See:

                     

                     

                    There is a lot of information in that object.  There is only one cell editor active at a time and it contains all you could possibly care about a cell being edited.

                     

                    Satyam

                     

                    ----- Original Message -----

                    Sent: Tuesday, September 04, 2007 9:43 AM

                    Subject: RE: [ydn-javascript] Editable datatable..

                    (Message over 64 KB, truncated)

                  • Nagasamudram, Prasanna Kumar
                    Is there a way to delete all the rows from the data table? deleteRow needs an index deleteRows needs a count --- I dint see any count property in the
                    Message 9 of 21 , Sep 6, 2007
                    • 0 Attachment

                      Is there a way to delete all the rows from the data table?

                       

                      deleteRow needs an index

                      deleteRows needs a count --- I dint see any count property in the datatable.js

                       

                       

                       

                       


                      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Nagasamudram, Prasanna Kumar
                      Sent: Tuesday, September 04, 2007 4:42 PM
                      To: ydn-javascript@yahoogroups.com
                      Subject: RE: [ydn-javascript] Editable datatable..

                       

                      Hi Satyam

                       

                      I’m sorry, please ignore my previous mail..

                       

                      column.key solves my problem.

                       

                       

                      Thanks a lot….

                      Prasanna

                       


                      From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                      Sent: Tuesday, September 04, 2007 4:38 PM
                      To: ydn-javascript@ yahoogroups. com
                      Subject: Re: [ydn-javascript] Editable datatable..

                       

                      The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.response Schema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.

                       

                      Satyam

                       

                      ----- Original Message -----

                      Sent: Tuesday, September 04, 2007 12:45 PM

                      Subject: RE: [ydn-javascript] Editable datatable..

                       

                      No I want the label….

                       

                      I want to do something like

                       

                      If (label is “aaa”)

                      {

                                  sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P1”)

                      }

                      If(label is “bbb”)

                      {

                                  sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P2”)

                       

                      }

                       

                       

                      Well I can do this wil the internal column name for example if its column 2 do this else do that.

                       

                      But what if I insert another column later….I need to change the above logic again.

                       

                      If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                       

                      Thanks

                      Prasanna

                       


                      From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                      Sent: Tuesday, September 04, 2007 3:20 PM
                      To: ydn-javascript@ yahoogroups. com
                      Subject: Re: [ydn-javascript] Editable datatable..

                       

                      You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.

                       

                      Satyam

                       

                      ----- Original Message -----

                      Sent: Tuesday, September 04, 2007 11:17 AM

                      Subject: RE: [ydn-javascript] Editable datatable..

                       

                      Thanks Satyam

                       

                      I would also like to get the column name

                       

                      But for some reason the following is returning null.

                       

                      alert(myDataTable. getCellEditor( ).column.label);

                       

                       

                       

                      Thanks

                      Prasanna


                      From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                      Sent: Tuesday, September 04, 2007 1:35 PM
                      To: ydn-javascript@ yahoogroups. com
                      Subject: Re: [ydn-javascript] Editable datatable..

                       

                      Yes:

                       

                      MyDataTable. getCellEditor( ).record

                       

                      See:

                    • Satyam
                      I guess we could find one but then, why bother? It might be cleaner and faster to instantiate a new empty one, using a local empty DataSource of type JS_ARRAY
                      Message 10 of 21 , Sep 6, 2007
                      • 0 Attachment
                        I guess we could find one but then, why bother? 
                         
                        It might be cleaner and faster to instantiate a new empty one, using a local empty DataSource of type JS_ARRAY or whatever you find easiest without going to the server.  How a table is initially loaded does not determine how it will be handled thereafter, nothing prevents you from loading it locally and then updating it remotely.
                         
                        Just remember to call myDataTable.destroy() on the old one to prevent memory leaks.
                         
                        Satyam
                         
                         
                         
                         
                        ----- Original Message -----
                        Sent: Thursday, September 06, 2007 1:10 PM
                        Subject: RE: [ydn-javascript] Editable datatable..

                        Is there a way to delete all the rows from the data table?

                         

                        deleteRow needs an index

                        deleteRows needs a count --- I dint see any count property in the datatable.js

                         

                         

                         

                         


                        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Nagasamudram, Prasanna Kumar
                        Sent: Tuesday, September 04, 2007 4:42 PM
                        To: ydn-javascript@yahoogroups.com
                        Subject: RE: [ydn-javascript] Editable datatable..

                         

                        Hi Satyam

                         

                        I’m sorry, please ignore my previous mail..

                         

                        column.key solves my problem.

                         

                         

                        Thanks a lot….

                        Prasanna

                         


                        From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                        Sent: Tuesday, September 04, 2007 4:38 PM
                        To: ydn-javascript@ yahoogroups. com
                        Subject: Re: [ydn-javascript] Editable datatable..

                         

                        The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.response Schema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.

                         

                        Satyam

                         

                        ----- Original Message -----

                        Sent: Tuesday, September 04, 2007 12:45 PM

                        Subject: RE: [ydn-javascript] Editable datatable..

                         

                        No I want the label….

                         

                        I want to do something like

                         

                        If (label is “aaa”)

                        {

                                    sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P1”)

                        }

                        If(label is “bbb”)

                        {

                                    sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P2”)

                         

                        }

                         

                         

                        Well I can do this wil the internal column name for example if its column 2 do this else do that.

                         

                        But what if I insert another column later….I need to change the above logic again.

                         

                        If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                         

                        Thanks

                        Prasanna

                         


                        From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                        Sent: Tuesday, September 04, 2007 3:20 PM
                        To: ydn-javascript@ yahoogroups. com
                        Subject: Re: [ydn-javascript] Editable datatable..

                         

                        You would probably want the column.key, not the label, which if null defaults to the key.  The label is just for the user to see, it might even be in different languages, the key is your internal name for the column.

                         

                        Satyam

                         

                        ----- Original Message -----

                        Sent: Tuesday, September 04, 2007 11:17 AM

                        Subject: RE: [ydn-javascript] Editable datatable..

                         

                        Thanks Satyam

                         

                        I would also like to get the column name

                         

                        But for some reason the following is returning null.

                         

                        (Message over 64 KB, truncated)

                      • Nagasamudram, Prasanna Kumar
                        Ya I think I need to call destroy All that I have is var my columset var mydatatable etc.. which gets called for each ajax request and I see the memory
                        Message 11 of 21 , Sep 7, 2007
                        • 0 Attachment

                          Ya I think I need to call destroy

                           

                          All that I have is

                           

                          var my columset

                          var mydatatable

                           

                          etc..

                           

                          which gets called for each ajax request and I see the memory consumption  goes up.

                           

                           

                           

                           

                           

                          Also when I click the sort link on the column, the sorting that is done is a string sort,

                           

                          How can I make it work as an Integer sort ?

                           

                          Thanks

                          Prasanna

                           


                          From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                          Sent: Thursday, September 06, 2007 5:47 PM
                          To: ydn-javascript@yahoogroups.com
                          Subject: Re: [ydn-javascript] Editable datatable..

                           

                          I guess we could find one but then, why bother? 

                           

                          It might be cleaner and faster to instantiate a new empty one, using a local empty DataSource of type JS_ARRAY or whatever you find easiest without going to the server.  How a table is initially loaded does not determine how it will be handled thereafter, nothing prevents you from loading it locally and then updating it remotely.

                           

                          Just remember to call myDataTable. destroy() on the old one to prevent memory leaks.

                           

                          Satyam

                           

                           

                           

                           

                          ----- Original Message -----

                          Sent: Thursday, September 06, 2007 1:10 PM

                          Subject: RE: [ydn-javascript] Editable datatable..

                           

                          Is there a way to delete all the rows from the data table?

                           

                          deleteRow needs an index

                          deleteRows needs a count --- I dint see any count property in the datatable.js

                           

                           

                           

                           


                          From: ydn-javascript@ yahoogroups. com [mailto: ydn- javascript@ yahoogroups. com ] On Behalf Of Nagasamudram, Prasanna Kumar
                          Sent: Tuesday, September 04, 2007 4:42 PM
                          To: ydn-javascript@ yahoogroups. com
                          Subject: RE: [ydn-javascript] Editable datatable..

                           

                          Hi Satyam

                           

                          I’m sorry, please ignore my previous mail..

                           

                          column.key solves my problem.

                           

                           

                          Thanks a lot….

                          Prasanna

                           


                          From: ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                          Sent: Tuesday, September 04, 2007 4:38 PM
                          To: ydn-javascript@ yahoogroups. com
                          Subject: Re: [ydn-javascript] Editable datatable..

                           

                          The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.response Schema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.

                           

                          Satyam

                           

                          ----- Original Message -----

                          Sent: Tuesday, September 04, 2007 12:45 PM

                          Subject: RE: [ydn-javascript] Editable datatable..

                           

                          No I want the label….

                           

                          I want to do something like

                           

                          If (label is “aaa”)

                          {

                                      sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P1”)

                          }

                          If(label is “bbb”)

                          {

                                      sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P2”)

                           

                          }

                           

                           

                          Well I can do this wil the internal column name for example if its column 2 do this else do that.

                           

                          But what if I insert another column later….I need to change the above logic again.

                           

                          If I compare it with the label name then the above logic remains intact, irrespective of the column position.

                           

                          Thanks

                          Prasanna

                        • Satyam
                          To ensure the sorting works on numbers, convert the field to numeric when it is received. In the DataSource, when you declare the fields in the fields array,
                          Message 12 of 21 , Sep 7, 2007
                          • 0 Attachment
                            To ensure the sorting works on numbers, convert the field to numeric when it is received.  In the DataSource, when you declare the fields in the fields array, instead of just naming the field, use:
                             
                            [key:'fieldOne',key:'fieldTwo',{key:'numericField,parser:YAHOO.util.DataSource.parseNumber},.....]
                            ----- Original Message -----
                            Sent: Friday, September 07, 2007 4:33 PM
                            Subject: RE: [ydn-javascript] Editable datatable..

                            Ya I think I need to call destroy

                             

                            All that I have is

                             

                            var my columset

                            var mydatatable

                             

                            etc..

                             

                            which gets called for each ajax request and I see the memory consumption  goes up.

                             

                             

                             

                             

                             

                            Also when I click the sort link on the column, the sorting that is done is a string sort,

                             

                            How can I make it work as an Integer sort ?

                             

                            Thanks

                            Prasanna

                             


                            From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Satyam
                            Sent: Thursday, September 06, 2007 5:47 PM
                            To: ydn-javascript@yahoogroups.com
                            Subject: Re: [ydn-javascript] Editable datatable..

                             

                            I guess we could find one but then, why bother? 

                             

                            It might be cleaner and faster to instantiate a new empty one, using a local empty DataSource of type JS_ARRAY or whatever you find easiest without going to the server.  How a table is initially loaded does not determine how it will be handled thereafter, nothing prevents you from loading it locally and then updating it remotely.

                             

                            Just remember to call myDataTable. destroy() on the old one to prevent memory leaks.

                             

                            Satyam

                             

                             

                             

                             

                            ----- Original Message -----

                            Sent: Thursday, September 06, 2007 1:10 PM

                            Subject: RE: [ydn-javascript] Editable datatable..

                             

                            Is there a way to delete all the rows from the data table?

                             

                            deleteRow needs an index

                            deleteRows needs a count --- I dint see any count property in the datatable.js

                             

                             

                             

                             


                            From: ydn-javascript@ yahoogroups. com [mailto: ydn- javascript@ yahoogroups. com ] On Behalf Of Nagasamudram, Prasanna Kumar
                            Sent: Tuesday, September 04, 2007 4:42 PM
                            To: ydn-javascript@ yahoogroups. com
                            Subject: RE: [ydn-javascript] Editable datatable..

                             

                            Hi Satyam

                             

                            I’m sorry, please ignore my previous mail..

                             

                            column.key solves my problem.

                             

                             

                            Thanks a lot….

                            Prasanna

                             


                            From:ydn-javascript@ yahoogroups. com [mailto: ydn-javascript@ yahoogroups. com ] On Behalf Of Satyam
                            Sent: Tuesday, September 04, 2007 4:38 PM
                            To: ydn-javascript@ yahoogroups. com
                            Subject: Re: [ydn-javascript] Editable datatable..

                             

                            The key is not the ordinal number of the column but the property key:'something' that you give the columns in the column definitions array and, for lack of inventiveness, I normally use the column name from the database which is also the name you use in the DataSource.response Schema.fields array.  In such case, that key value is precisely what the database would want: the column name of the database table.

                             

                            Satyam

                             

                            ----- Original Message -----

                            Sent: Tuesday, September 04, 2007 12:45 PM

                            Subject: RE: [ydn-javascript] Editable datatable..

                             

                            No I want the label….

                             

                            I want to do something like

                             

                            If (label is “aaa”)

                            {

                                        sendAjaxrequest( myDataTable. getCellEditor( ).getData( "param1") , “P1”)

                            }

                            If(label is “bbb”)

                            {


                            (Message over 64 KB, truncated)

                          Your message has been successfully submitted and would be delivered to recipients shortly.