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

Re: [ydn-javascript] Access Column from Row Formatter

Expand Messages
  • Eric Cire
    Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( column_name ) which makes
    Message 1 of 13 , Jan 7, 2010
    • 0 Attachment
      Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData("column_name") which makes me feel like there should be a way to iterate over fields...


      From: Eric Cire <codedude11@...>
      To: ydn-javascript@yahoogroups.com
      Sent: Thu, January 7, 2010 10:32:50 AM
      Subject: Re: [ydn-javascript] Access Column from Row Formatter

       

      I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

      Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
       this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
      if(oRecord.getData( "field3") > 100) {
      YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
      elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
      }
      else {

      YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "up","down") ;
      elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
      }
      };

      I am basically looking to do something along the lines of:

      if(oRecord.getData( "column 5") < 10 {
              oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
      }

      Is there something in the API which I could use?

      Thanks.

      From: Satyam <satyam@satyam. com.ar>
      To: ydn-javascript@ yahoogroups. com
      Sent: Wed, January 6, 2010 5:29:01 PM
      Subject: Re: [ydn-javascript] Access Column from Row Formatter

       

      Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

      Satyam

      El 06/01/2010 23:04, Eric Cire escribió:

      is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


      From: Satyam <satyam@satyam. com.ar>
      To: ydn-javascript@ yahoogroups. com
      Sent: Wed, January 6, 2010 3:53:35 PM
      Subject: Re: [ydn-javascript] Access Column from Row Formatter

       

      You would then use a formatter on the column, not a generic row formatter:

      http://developer. yahoo.com/ yui/datatable/ #format

      Satyam

      El 06/01/2010 21:09, Eric Cire escribió:

      Hi Group,

      I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

      Looking for any suggestions.

      Thanks!



      No virus found in this incoming message. Checked by AVG - www.avg.com
      Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


      No virus found in this incoming message. Checked by AVG - www.avg.com
      Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00



    • Satyam
      If you use getData without any arguments, it will give you an object literal representing the whole record. You can iterate over that, but remember it is just
      Message 2 of 13 , Jan 8, 2010
      • 0 Attachment
        If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

        Satyam

        El 07/01/2010 18:00, Eric Cire escribió:
        Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData("column_name") which makes me feel like there should be a way to iterate over fields...


        From: Eric Cire <codedude11@...>
        To: ydn-javascript@yahoogroups.com
        Sent: Thu, January 7, 2010 10:32:50 AM
        Subject: Re: [ydn-javascript] Access Column from Row Formatter

         
        I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

        Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
         this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
                    if(oRecord.getData( "field3") > 100) {
                        YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
                        elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
                    }
                    else {
         
                       YAHOO.util.Dom. replaceClass(
         elLiner.parentNo de, "up","down") ;
                        elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
                    }
                };
          

        I am basically looking to do something along the lines of:

        if(oRecord.getData( "column 5") < 10 {
                oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
        }

        Is there something in the API which I could use?

        Thanks.

        From: Satyam <satyam@satyam. com.ar>
        To: ydn-javascript@ yahoogroups. com
        Sent: Wed, January 6, 2010 5:29:01 PM
        Subject: Re: [ydn-javascript] Access Column from Row Formatter

         

        Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

        Satyam

        El 06/01/2010 23:04, Eric Cire escribió:

        is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


        From: Satyam <satyam@satyam. com.ar>
        To: ydn-javascript@ yahoogroups. com
        Sent: Wed, January 6, 2010 3:53:35 PM
        Subject: Re: [ydn-javascript] Access Column from Row Formatter

         

        You would then use a formatter on the column, not a generic row formatter:

        http://developer. yahoo.com/ yui/datatable/ #format

        Satyam

        El 06/01/2010 21:09, Eric Cire escribió:

        Hi Group,

        I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

        Looking for any suggestions.

        Thanks!



        No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00

        No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


        No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00
      • Eric Cire
        Looking over the DataTable API (http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getTdEl), I found a method called getTdEl (below):
        Message 3 of 13 , Jan 8, 2010
        • 0 Attachment
          Looking over the DataTable API (http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getTdEl), I found a method called getTdEl (below):

          HTMLElement getTdEl ( cell )
          Returns DOM reference to a TD element.
          Parameters:
          cell <HTMLElement | String | Object} TD element or child of a TD element, or object literal of syntax {record:oRecord, column:oColumn> .
          Returns: HTMLElement
          Reference to TD element.

          How do I call this method using the object literal syntax? What I did is below:

                  function setupCellColor( columnName, cellColorScheme, oRecord ){
                 
                      var cellData = oRecord.getData(columnName);
                      var oColumn = getColumnDefs();
                      var x = self.dataTable.getTdEl({record: oRecord, column:oColumn});
                      alert(x);
                      return true;
                  }
                 
          The alert(x) statement alerts "null" for each row.

          Thanks.

          From: Satyam <satyam@...>
          To: ydn-javascript@yahoogroups.com
          Sent: Fri, January 8, 2010 10:12:36 AM
          Subject: Re: [ydn-javascript] Access Column from Row Formatter

           

          If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

          Satyam

          El 07/01/2010 18:00, Eric Cire escribió:

          Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( "column_name" ) which makes me feel like there should be a way to iterate over fields...


          From: Eric Cire <codedude11@yahoo. com>
          To: ydn-javascript@ yahoogroups. com
          Sent: Thu, January 7, 2010 10:32:50 AM
          Subject: Re: [ydn-javascript] Access Column from Row Formatter

           
          I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

          Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
           this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
          if(oRecord.getData( "field3") > 100) {
          YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
          elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
          }
          else {

          YAHOO.util.Dom. replaceClass(
          elLiner.parentNo de, "up","down") ;
          elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
          }
          };

          I am basically looking to do something along the lines of:

          if(oRecord.getData( "column 5") < 10 {
                  oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
          }

          Is there something in the API which I could use?

          Thanks.

          From: Satyam <satyam@satyam. com.ar>
          To: ydn-javascript@ yahoogroups. com
          Sent: Wed, January 6, 2010 5:29:01 PM
          Subject: Re: [ydn-javascript] Access Column from Row Formatter

           

          Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

          Satyam

          El 06/01/2010 23:04, Eric Cire escribió:

          is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


          From: Satyam <satyam@satyam. com.ar>
          To: ydn-javascript@ yahoogroups. com
          Sent: Wed, January 6, 2010 3:53:35 PM
          Subject: Re: [ydn-javascript] Access Column from Row Formatter

           

          You would then use a formatter on the column, not a generic row formatter:

          http://developer. yahoo.com/ yui/datatable/ #format

          Satyam

          El 06/01/2010 21:09, Eric Cire escribió:

          Hi Group,

          I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

          Looking for any suggestions.

          Thanks!



          No virus found in this incoming message. Checked by AVG - www.avg.com
          Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


          No virus found in this incoming message. Checked by AVG - www.avg.com
          Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00



          No virus found in this incoming message. Checked by AVG - www.avg.com
          Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00


        • Satyam
          This is not a good idea. If you set it like that, whenever the table is refreshed, such as when it is sorted or a row re-rendered, the color will be lost.
          Message 4 of 13 , Jan 8, 2010
          • 0 Attachment
            This is not a good idea.   If you set it like that, whenever the table is refreshed, such as when it is sorted or a row re-rendered, the color will be lost.   The color of each cell should be produced by the cell formatter of the affected cell.  If you want a foreign column to change it, use updateCell() to change both, the underlying record field and the TD element.  That make sure that what is shown on the screen is always a representation of the underlying data, otherwise, things start going funny.



            El 08/01/2010 19:45, Eric Cire escribió:
            Looking over the DataTable API (http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#method_getTdEl), I found a method called getTdEl (below):

            HTMLElement getTdEl ( cell )
            Returns DOM reference to a TD element.
            Parameters:
            cell <HTMLElement | String | Object} TD element or child of a TD element, or object literal of syntax {record:oRecord, column:oColumn> .
            Returns: HTMLElement
            Reference to TD element.

            How do I call this method using the object literal syntax? What I did is below:

                    function setupCellColor( columnName, cellColorScheme, oRecord ){
                   
                        var cellData = oRecord.getData(columnName);
                        var oColumn = getColumnDefs();
                        var x = self.dataTable.getTdEl({record: oRecord, column:oColumn});
                        alert(x);
                        return true;
                    }
                   
            The alert(x) statement alerts "null" for each row.

            Thanks.

            From: Satyam <satyam@...>
            To: ydn-javascript@yahoogroups.com
            Sent: Fri, January 8, 2010 10:12:36 AM
            Subject: Re: [ydn-javascript] Access Column from Row Formatter

             

            If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

            Satyam

            El 07/01/2010 18:00, Eric Cire escribió:

            Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( "column_name" ) which makes me feel like there should be a way to iterate over fields...


            From: Eric Cire <codedude11@yahoo. com>
            To: ydn-javascript@ yahoogroups. com
            Sent: Thu, January 7, 2010 10:32:50 AM
            Subject: Re: [ydn-javascript] Access Column from Row Formatter

             
            I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

            Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
             this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
                        if(oRecord.getData( "field3") > 100) {
                            YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
                            elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
                        }
                        else {
             
                           YAHOO.util.Dom. replaceClass(
             elLiner.parentNo de, "up","down") ;
                            elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
                        }
                    };
              

            I am basically looking to do something along the lines of:

            if(oRecord.getData( "column 5") < 10 {
                    oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
            }

            Is there something in the API which I could use?

            Thanks.

            From: Satyam <satyam@satyam. com.ar>
            To: ydn-javascript@ yahoogroups. com
            Sent: Wed, January 6, 2010 5:29:01 PM
            Subject: Re: [ydn-javascript] Access Column from Row Formatter

             

            Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

            Satyam

            El 06/01/2010 23:04, Eric Cire escribió:

            is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


            From: Satyam <satyam@satyam. com.ar>
            To: ydn-javascript@ yahoogroups. com
            Sent: Wed, January 6, 2010 3:53:35 PM
            Subject: Re: [ydn-javascript] Access Column from Row Formatter

             

            You would then use a formatter on the column, not a generic row formatter:

            http://developer. yahoo.com/ yui/datatable/ #format

            Satyam

            El 06/01/2010 21:09, Eric Cire escribió:

            Hi Group,

            I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

            Looking for any suggestions.

            Thanks!



            No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00

            No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


            No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00

            No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/08/10 08:35:00
          • Eric Cire
            Thanks Satyam. The challenge (customer requirement) I have is that I can not use CSS because all the color information in the application is custom configured
            Message 5 of 13 , Jan 8, 2010
            • 0 Attachment
              Thanks Satyam. The challenge (customer requirement) I have is that I can not use CSS because all the color information in the application is custom configured by each user and stroed in a database. All I get back are color values of individual cells. I can not evaluate data as in the YUI examples where it is something like.... if(oData > 10)... paint "red" because it is not directly related to the value in that cell. What is left is to set the background color of a tdEl when the row is painted. When setting at the elCell or elLiner level as you suggested, it appears that it only paints the data div, not the entire height of the row and because it is in the Column formatter, it applies it to the entire column, not jsut a cell. If I put this code into a row formatter, I do not have column access.

              <tr id="yui-rec68" class="yui-dt-odd yui-dt-selected" style="background-color: rgb(0, 128, 64); color: rgb(0, 0, 0);">

                  <td class="align-left-center align-header-center-center yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-        col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-       resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType             yui-dt-sortable yui-dt-resizeable" headers="yui-dt0-th-PaymentType ">

                          <div class="yui-dt-liner">Cash</div>

              The elLiner.background color is NOT the whole cell, it only occupies the data DIV portion of the cell (word-wrap enabled).

              Is there a way that I can color entire individual cells, elTd, without using .td in a CSS class.

              Thanks.

              From: Satyam <satyam@...>
              To: ydn-javascript@yahoogroups.com
              Sent: Fri, January 8, 2010 2:10:06 PM
              Subject: Re: [ydn-javascript] Access Column from Row Formatter

               

              This is not a good idea.   If you set it like that, whenever the table is refreshed, such as when it is sorted or a row re-rendered, the color will be lost.   The color of each cell should be produced by the cell formatter of the affected cell.  If you want a foreign column to change it, use updateCell() to change both, the underlying record field and the TD element.  That make sure that what is shown on the screen is always a representation of the underlying data, otherwise, things start going funny.



              El 08/01/2010 19:45, Eric Cire escribió:

              Looking over the DataTable API (http://developer. yahoo.com/ yui/docs/ YAHOO.widget. DataTable. html#method_ getTdEl), I found a method called getTdEl (below):

              HTMLElement getTdEl ( cell )
              Returns DOM reference to a TD element.
              Parameters:
              cell <HTMLElement | String | Object} TD element or child of a TD element, or object literal of syntax {record:oRecord, column:oColumn> .
              Returns: HTMLElement
              Reference to TD element.

              How do I call this method using the object literal syntax? What I did is below:

                      function setupCellColor( columnName, cellColorScheme, oRecord ){
                     
                          var cellData = oRecord.getData( columnName) ;
                          var oColumn = getColumnDefs( );
                          var x = self.dataTable.. getTdEl({ record: oRecord, column:oColumn} );
                          alert(x);
                          return true;
                      }
                     
              The alert(x) statement alerts "null" for each row.

              Thanks.

              From: Satyam <satyam@satyam. com.ar>
              To: ydn-javascript@ yahoogroups. com
              Sent: Fri, January 8, 2010 10:12:36 AM
              Subject: Re: [ydn-javascript] Access Column from Row Formatter

               

              If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

              Satyam

              El 07/01/2010 18:00, Eric Cire escribió:

              Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( "column_name" ) which makes me feel like there should be a way to iterate over fields...


              From: Eric Cire <codedude11@yahoo. com>
              To: ydn-javascript@ yahoogroups. com
              Sent: Thu, January 7, 2010 10:32:50 AM
              Subject: Re: [ydn-javascript] Access Column from Row Formatter

               
              I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

              Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
               this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
              if(oRecord.getData( "field3") > 100) {
              YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
              elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
              }
              else {

              YAHOO.util.Dom. replaceClass(
              elLiner.parentNo de, "up","down") ;
              elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
              }
              };

              I am basically looking to do something along the lines of:

              if(oRecord.getData( "column 5") < 10 {
                      oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
              }

              Is there something in the API which I could use?

              Thanks.

              From: Satyam <satyam@satyam. com.ar>
              To: ydn-javascript@ yahoogroups. com
              Sent: Wed, January 6, 2010 5:29:01 PM
              Subject: Re: [ydn-javascript] Access Column from Row Formatter

               

              Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

              Satyam

              El 06/01/2010 23:04, Eric Cire escribió:

              is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


              From: Satyam <satyam@satyam. com.ar>
              To: ydn-javascript@ yahoogroups. com
              Sent: Wed, January 6, 2010 3:53:35 PM
              Subject: Re: [ydn-javascript] Access Column from Row Formatter

               

              You would then use a formatter on the column, not a generic row formatter:

              http://developer. yahoo.com/ yui/datatable/ #format

              Satyam

              El 06/01/2010 21:09, Eric Cire escribió:

              Hi Group,

              I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

              Looking for any suggestions.

              Thanks!



              No virus found in this incoming message. Checked by AVG - www.avg.com
              Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


              No virus found in this incoming message. Checked by AVG - www.avg.com
              Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00



              No virus found in this incoming message. Checked by AVG - www.avg.com
              Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00


              No virus found in this incoming message. Checked by AVG - www.avg.com
              Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/08/10 08:35:00


            • Satyam
              Ok, you should use setStyle to color it then, not adding or removing classes, that is the standard thing to do but it does not apply to you. getTdEl()
              Message 6 of 13 , Jan 9, 2010
              • 0 Attachment
                Ok, you should use setStyle to color it then, not adding or removing classes, that is the standard thing to do but it does not apply to you.   getTdEl() accepts a reference to a DOM node, thus, you could do getTdEl(elLiner).   The TD is the parentNode of the liner, I know, but there was no liner a few versions back and though the DataTable is out of beta, getTdEl is the public, supported interface and assuming a particular markup is not.

                Satyam


                El 08/01/2010 21:49, Eric Cire escribió:
                Thanks Satyam. The challenge (customer requirement) I have is that I can not use CSS because all the color information in the application is custom configured by each user and stroed in a database. All I get back are color values of individual cells. I can not evaluate data as in the YUI examples where it is something like.... if(oData > 10)... paint "red" because it is not directly related to the value in that cell. What is left is to set the background color of a tdEl when the row is painted. When setting at the elCell or elLiner level as you suggested, it appears that it only paints the data div, not the entire height of the row and because it is in the Column formatter, it applies it to the entire column, not jsut a cell. If I put this code into a row formatter, I do not have column access.

                <tr id="yui-rec68" class="yui-dt-odd yui-dt-selected" style="background-color: rgb(0, 128, 64); color: rgb(0, 0, 0);">

                    <td class="align-left-center align-header-center-center yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-        col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-       resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType yui-dt-sortable yui-dt-resizeable yui-dt0-col-PaymentType yui-dt-col-PaymentType             yui-dt-sortable yui-dt-resizeable" headers="yui-dt0-th-PaymentType ">

                            <div class="yui-dt-liner">Cash</div>

                The elLiner.background color is NOT the whole cell, it only occupies the data DIV portion of the cell (word-wrap enabled).

                Is there a way that I can color entire individual cells, elTd, without using .td in a CSS class.

                Thanks.

                From: Satyam <satyam@...>
                To: ydn-javascript@yahoogroups.com
                Sent: Fri, January 8, 2010 2:10:06 PM
                Subject: Re: [ydn-javascript] Access Column from Row Formatter

                 

                This is not a good idea.   If you set it like that, whenever the table is refreshed, such as when it is sorted or a row re-rendered, the color will be lost.   The color of each cell should be produced by the cell formatter of the affected cell.  If you want a foreign column to change it, use updateCell() to change both, the underlying record field and the TD element.  That make sure that what is shown on the screen is always a representation of the underlying data, otherwise, things start going funny.



                El 08/01/2010 19:45, Eric Cire escribió:

                Looking over the DataTable API (http://developer. yahoo.com/ yui/docs/ YAHOO.widget. DataTable. html#method_ getTdEl), I found a method called getTdEl (below):

                HTMLElement getTdEl ( cell )
                Returns DOM reference to a TD element.
                Parameters:
                cell <HTMLElement | String | Object} TD element or child of a TD element, or object literal of syntax {record:oRecord, column:oColumn> .
                Returns: HTMLElement
                Reference to TD element.

                How do I call this method using the object literal syntax? What I did is below:

                        function setupCellColor( columnName, cellColorScheme, oRecord ){
                       
                            var cellData = oRecord.getData( columnName) ;
                            var oColumn = getColumnDefs( );
                            var x = self.dataTable.. getTdEl({ record: oRecord, column:oColumn} );
                            alert(x);
                            return true;
                        }
                       
                The alert(x) statement alerts "null" for each row.

                Thanks.

                From: Satyam <satyam@satyam. com.ar>
                To: ydn-javascript@ yahoogroups. com
                Sent: Fri, January 8, 2010 10:12:36 AM
                Subject: Re: [ydn-javascript] Access Column from Row Formatter

                 

                If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

                Satyam

                El 07/01/2010 18:00, Eric Cire escribió:

                Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( "column_name" ) which makes me feel like there should be a way to iterate over fields...


                From: Eric Cire <codedude11@yahoo. com>
                To: ydn-javascript@ yahoogroups. com
                Sent: Thu, January 7, 2010 10:32:50 AM
                Subject: Re: [ydn-javascript] Access Column from Row Formatter

                 
                I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

                Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
                 this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
                            if(oRecord.getData( "field3") > 100) {
                                YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
                                elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
                            }
                            else {
                 
                               YAHOO.util.Dom. replaceClass(
                 elLiner.parentNo de, "up","down") ;
                                elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
                            }
                        };
                  

                I am basically looking to do something along the lines of:

                if(oRecord.getData( "column 5") < 10 {
                        oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
                }

                Is there something in the API which I could use?

                Thanks.

                From: Satyam <satyam@satyam. com.ar>
                To: ydn-javascript@ yahoogroups. com
                Sent: Wed, January 6, 2010 5:29:01 PM
                Subject: Re: [ydn-javascript] Access Column from Row Formatter

                 

                Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

                Satyam

                El 06/01/2010 23:04, Eric Cire escribió:

                is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


                From: Satyam <satyam@satyam. com.ar>
                To: ydn-javascript@ yahoogroups. com
                Sent: Wed, January 6, 2010 3:53:35 PM
                Subject: Re: [ydn-javascript] Access Column from Row Formatter

                 

                You would then use a formatter on the column, not a generic row formatter:

                http://developer. yahoo.com/ yui/datatable/ #format

                Satyam

                El 06/01/2010 21:09, Eric Cire escribió:

                Hi Group,

                I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

                Looking for any suggestions.

                Thanks!



                No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00

                No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


                No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00

                No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/08/10 08:35:00

                No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/08/10 08:35:00
              • Eric Cire
                GREAT! Thanks a lot! Looks like all is working now. ________________________________ From: Satyam To: ydn-javascript@yahoogroups.com
                Message 7 of 13 , Jan 9, 2010
                • 0 Attachment
                  GREAT! Thanks a lot! Looks like all is working now.


                  From: Satyam <satyam@...>
                  To: ydn-javascript@yahoogroups.com
                  Sent: Sat, January 9, 2010 8:11:02 AM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   

                  Ok, you should use setStyle to color it then, not adding or removing classes, that is the standard thing to do but it does not apply to you.   getTdEl() accepts a reference to a DOM node, thus, you could do getTdEl(elLiner) ..   The TD is the parentNode of the liner, I know, but there was no liner a few versions back and though the DataTable is out of beta, getTdEl is the public, supported interface and assuming a particular markup is not.

                  Satyam


                  El 08/01/2010 21:49, Eric Cire escribió:

                  Thanks Satyam. The challenge (customer requirement) I have is that I can not use CSS because all the color information in the application is custom configured by each user and stroed in a database. All I get back are color values of individual cells. I can not evaluate data as in the YUI examples where it is something like.... if(oData > 10)... paint "red" because it is not directly related to the value in that cell. What is left is to set the background color of a tdEl when the row is painted. When setting at the elCell or elLiner level as you suggested, it appears that it only paints the data div, not the entire height of the row and because it is in the Column formatter, it applies it to the entire column, not jsut a cell. If I put this code into a row formatter, I do not have column access.

                  <tr id="yui-rec68" class="yui-dt-odd yui-dt-selected" style="background-color: rgb(0, 128, 64); color: rgb(0, 0, 0);">

                      <td class="align-left-center align-header- center-center yui-dt0-col- PaymentType yui-dt-col-PaymentT ype yui-dt-sortable yui-dt-resizeable yui-dt0-        col-PaymentType yui-dt-col-PaymentT ype yui-dt-sortable yui-dt-resizeable yui-dt0-col- PaymentType yui-dt-col-PaymentT ype yui-dt-sortable yui-dt-       resizeable yui-dt0-col- PaymentType yui-dt-col-PaymentT ype yui-dt-sortable yui-dt-resizeable yui-dt0-col- PaymentType yui-dt-col-PaymentT ype             yui-dt-sortable yui-dt-resizeable" headers="yui-dt0-th-PaymentT ype ">

                              <div class="yui-dt-liner">Cash</div>

                  The elLiner.background color is NOT the whole cell, it only occupies the data DIV portion of the cell (word-wrap enabled).

                  Is there a way that I can color entire individual cells, elTd, without using .td in a CSS class.

                  Thanks.

                  From: Satyam <satyam@satyam. com.ar>
                  To: ydn-javascript@ yahoogroups. com
                  Sent: Fri, January 8, 2010 2:10:06 PM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   

                  This is not a good idea.   If you set it like that, whenever the table is refreshed, such as when it is sorted or a row re-rendered, the color will be lost.   The color of each cell should be produced by the cell formatter of the affected cell.  If you want a foreign column to change it, use updateCell() to change both, the underlying record field and the TD element.  That make sure that what is shown on the screen is always a representation of the underlying data, otherwise, things start going funny.



                  El 08/01/2010 19:45, Eric Cire escribió:

                  Looking over the DataTable API (http://developer. yahoo.com/ yui/docs/ YAHOO.widget. DataTable. html#method_ getTdEl), I found a method called getTdEl (below):

                  HTMLElement getTdEl ( cell )
                  Returns DOM reference to a TD element.
                  Parameters:
                  cell <HTMLElement | String | Object} TD element or child of a TD element, or object literal of syntax {record:oRecord, column:oColumn> .
                  Returns: HTMLElement
                  Reference to TD element.

                  How do I call this method using the object literal syntax? What I did is below:

                          function setupCellColor( columnName, cellColorScheme, oRecord ){
                         
                              var cellData = oRecord.getData( columnName) ;
                              var oColumn = getColumnDefs( );
                              var x = self.dataTable. . getTdEl({ record: oRecord, column:oColumn} );
                              alert(x);
                              return true;
                          }
                         
                  The alert(x) statement alerts "null" for each row.

                  Thanks.

                  From: Satyam <satyam@satyam. com.ar>
                  To: ydn-javascript@ yahoogroups. com
                  Sent: Fri, January 8, 2010 10:12:36 AM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   

                  If you use getData without any arguments, it will give you an object literal representing the whole record.  You can iterate over that, but remember it is just a copy of the original record, any changes on it would get lost.

                  Satyam

                  El 07/01/2010 18:00, Eric Cire escribió:

                  Or another way I can pose the question is - is there a Record method which iterates over each field/column. There is record.getData( "column_name" ) which makes me feel like there should be a way to iterate over fields...


                  From: Eric Cire <codedude11@yahoo. com>
                  To: ydn-javascript@ yahoogroups. com
                  Sent: Thu, January 7, 2010 10:32:50 AM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   
                  I guess my question was poorly stated from the start.. I am looking to see if I can format a color of a specific CELL in a column based on data in a different column of the same record/row.

                  Looking at the example on DataTable main page, I see the custom cell formatting done with the arrows (col. 1) where it simply gets the data. I could not find functions in API to go to specific column to do the coloring though.
                   this.myCustomFormat ter = function(elLiner, oRecord, oColumn, oData) {
                  if(oRecord.getData( "field3") > 100) {
                  YAHOO.util.Dom. replaceClass( elLiner.parentNo de, "down", "up");
                  elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- up.png">';
                  }
                  else {

                  YAHOO.util.Dom. replaceClass(
                  elLiner.parentNo de, "up","down") ;
                  elLiner.innerHTML = ' <img src="../../build/ datatable/ assets/skins/ sam/dt-arrow- dn.png">';
                  }
                  };

                  I am basically looking to do something along the lines of:

                  if(oRecord.getData( "column 5") < 10 {
                          oRecord.setInnerHTM L("column 2").backgroundColor = "blue";
                  }

                  Is there something in the API which I could use?

                  Thanks.

                  From: Satyam <satyam@satyam.. com.ar>
                  To: ydn-javascript@ yahoogroups. com
                  Sent: Wed, January 6, 2010 5:29:01 PM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   

                  Nope, you can assign only one formatter per column, which can do as many things required.  Anyway, a single column is not supposed to have more than one field in the record so, there is probably more to your question that meets the eye.  A cell formatter has access to all the fields in a record so it can make a composite of several of them. 

                  Satyam

                  El 06/01/2010 23:04, Eric Cire escribió:

                  is it possible to use more than one formatter on a column? for example, the same column needs to be formatted dealing with colors and also dealing with dates?


                  From: Satyam <satyam@satyam. com.ar>
                  To: ydn-javascript@ yahoogroups. com
                  Sent: Wed, January 6, 2010 3:53:35 PM
                  Subject: Re: [ydn-javascript] Access Column from Row Formatter

                   

                  You would then use a formatter on the column, not a generic row formatter:

                  http://developer. yahoo.com/ yui/datatable/ #format

                  Satyam

                  El 06/01/2010 21:09, Eric Cire escribió:

                  Hi Group,

                  I'm fairly new to YUI and need to format a column from my row formatter. I looked into several YUI examples and could not find it. I want something along the lines of a getColumnByKey( "ColumnHeaderNam e");. My issue is that I do not have access to the COLUMNS at this point..

                  Looking for any suggestions.

                  Thanks!



                  No virus found in this incoming message. Checked by AVG - www.avg.com
                  Version: 9.0.725 / Virus Database: 270.14.127/2603 - Release Date: 01/06/10 08:35:00


                  No virus found in this incoming message. Checked by AVG - www.avg.com
                  Version: 9.0.725 / Virus Database: 270.14..127/2603 - Release Date: 01/06/10 08:35:00



                  No virus found in this incoming message. Checked by AVG - www.avg.com
                  Version: 9.0.725 / Virus Database: 270.14.129/2605 - Release Date: 01/07/10 08:35:00


                  No virus found in this incoming message. Checked by AVG - www.avg.com
                  Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/08/10 08:35:00


                  No virus found in this incoming message. Checked by AVG - www.avg.com
                  Version: 9.0.725 / Virus Database: 270..14.130/2607 - Release Date: 01/08/10 08:35:00


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