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

Re: [ydn-javascript] Inline editing of datatable cells - can't build reference

Expand Messages
  • Satyam
    Try: this.myDataTable.subscribe( editorSaveEvent ,function (oArgs) { var rec = oArgs.editor.record; this.getRecordSet().updateKey(rec, Total ,
    Message 1 of 4 , Nov 30, 2007
    • 0 Attachment
      Try:
       
      this.myDataTable.subscribe('editorSaveEvent',function (oArgs) {
          var rec = oArgs.editor.record;
          this.getRecordSet().updateKey(rec, 'Total',  rec.getData('Amount') * rec.getData('Cost'));
          this.refreshRow(oArgs.editor.cell);
      });
       
       
      You can also use updateRow instead of updateKey:
       
      this.myDataTable.subscribe('editorSaveEvent',function (oArgs) {
          var rec = oArgs.editor.record;
          var oldRec = this.getData();
          oldRec['Total'] = oldRec['Amount'] * oldRec['Cost'];
          this.updateRow(rec,olrdRec);
          this.refreshRow(oArgs.editor.cell);
      });
       
      Both use refreshRow which is declared as:
       
      YAHOO.widget.DataTable.prototype.refreshRow = function(row) {
           var $D = YAHOO.util.Dom;
           $D.batch($D.getChildren(this.getTrEl(row)),this.formatCell,this,true);
      };
       
      (I have added this method to my own version of DataTable, but you might declare it in your own namespace)
       
      I haven't tested it, but it shouldn't be very far from this.
       
      Satyam
       
      ----- Original Message -----
      Sent: Friday, November 30, 2007 8:33 PM
      Subject: Re: [ydn-javascript] Inline editing of datatable cells - can't build reference

      For simplicity I have a table of three columns. 

      Amount |  Cost  |  Total

      The Amount column can be edited and when it is, i need to take that number, multiply it by the second cell in that row and place that value in the third cell of that same row.

      Thanks again,
      CK



      Satyam said the following on 2007-11-30 01:20:

      What are you missing?  How could I know! What is it that you mean to do?  In your last question I had to offer you lots of information expecting that some of it might help in whatever it is you want to do, but you keep showing us code with plenty of alert() calls trying to show this and that but no clue about what is it you mean to do.  I mean, I think I covered all you can extract from the arguments to the editorSaveEvent and you still seem to need more.  What is it that you want?
       
      Satyam


      No virus found in this incoming message.
      Checked by AVG Free Edition.
      Version: 7.5.503 / Virus Database: 269.16.10/1160 - Release Date: 29/11/2007 20:32
    Your message has been successfully submitted and would be delivered to recipients shortly.