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

Inline editing of datatable cells - can't build reference

Expand Messages
  • kayec_53
    Hi ! I m really suck and a lot of the table manipulation i need to do will be based on this working. I have drawn a table with a few in-line editable fields.
    Message 1 of 4 , Nov 29, 2007
    • 0 Attachment
      Hi !

      I'm really suck and a lot of the table manipulation i need to do will be based on this working.

      I have drawn a table with a few in-line editable fields.  This table is subscribed to "editorSaveEvent" which fires off the following function.

      DNS.onEventRecalculateScreenData = function(oArgs) {

      //The cell that was updated ie: "yui-dt0-bdrow3-cell4"
          sTheUpdatedCell = oArgs.editor.cell.id;
          

      //Direct reference to another cell, returns [object HTMLTableCellElement]
      //I have no idea with to do with this.
          var oSomething = YAHOO.util.Dom.get("yui-dt0-bdrow8-cell6");
          alert(oSomething);
      };

      Please help if you know what i'm missing.  I'm really stuck on this.
      Thanks everyone,
      CK



    • Satyam
      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
      Message 2 of 4 , Nov 30, 2007
      • 0 Attachment
        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
         
        ----- Original Message -----
        From: kayec_53
        Sent: Friday, November 30, 2007 12:59 AM
        Subject: [ydn-javascript] Inline editing of datatable cells - can't build reference

        Hi !

        I'm really suck and a lot of the table manipulation i need to do will be based on this working.

        I have drawn a table with a few in-line editable fields.  This table is subscribed to "editorSaveEvent" which fires off the following function.

        DNS.onEventRecalculateScreenData = function(oArgs) {

        //The cell that was updated ie: "yui-dt0-bdrow3-cell4"
            sTheUpdatedCell = oArgs.editor.cell.id;
            

        //Direct reference to another cell, returns [object HTMLTableCellElement]
        //I have no idea with to do with this.
            var oSomething = YAHOO.util.Dom.get("yui-dt0-bdrow8-cell6");
            alert(oSomething);
        };

        Please help if you know what i'm missing.  I'm really stuck on this.
        Thanks everyone,
        CK




        No virus found in this incoming message.
        Checked by AVG Free Edition.
        Version: 7.5.503 / Virus Database: 269.16.9/1158 - Release Date: 28/11/2007 21:11
      • Corey Kaye
        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
        Message 3 of 4 , Nov 30, 2007
        • 0 Attachment
          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

        • Satyam
          Try: this.myDataTable.subscribe( editorSaveEvent ,function (oArgs) { var rec = oArgs.editor.record; this.getRecordSet().updateKey(rec, Total ,
          Message 4 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.