Results 1 to 3 of 3

Thread: can we read columns in renderer

  1. #1

    Default can we read columns in renderer

    Hi,

    Can I use the colF and colG in the renderer section of colE? Please have a look at colE>renderer section.

    Code:
    var rec = Ext.data.Record.create([
         {name: 'colC'},
         {name: 'colD'},
         {name: 'colE'},
         {name: 'colF'},
         {name: 'colG'}
     ]);
     
     Ext.apply(this, {
                store: newStore,
     
                columns: [
                   {header: 'C', width: 100, sortable: true, dataIndex: 'colC'},
                   {header: 'D', width: 100, sortable: true, dataIndex: 'colD'},
                   {header: 'E', width: 100, sortable: true, dataIndex: 'colE', 
                     renderer: function(data, cell){
     
                     /// how can we use colF and colG in this section?
                           return getProcessedData(data, colF, colG);
                      }
                   }
             ]
            });

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    From the docs Ext.grid.Column

    Code:
    renderer : Mixed
    (optional) An "interceptor" method which can be used transform data (value, appearance, etc.) before it is rendered...
    
    (optional) An "interceptor" method which can be used transform data (value, appearance, etc.) before it is rendered). This may be specified in either of three ways:
    
        * A renderer function used to return HTML markup for a cell given the cell's data value.
        * A string which references a property name of the Ext.util.Format class which provides a renderer function.
        * An object specifying both the renderer function, and its execution scope (this reference) eg:
    
          {
              fn: this.gridRenderer,
              scope: this
          }
    
    If not specified, the default renderer uses the raw data value.
    
    For information about the renderer function (passed parameters, etc.), see Ext.grid.ColumnModel.setRenderer. An example of specifying renderer function inline:
    
    var companyColumn = {
       header: "Company Name",
       dataIndex: "company",
       renderer: function(value, metaData, record, rowIndex, colIndex, store) {
          // provide the logic depending on business rules 
    
          // name of your own choosing to manipulate the cell depending upon
    
          // the data in the underlying Record object.
    
          if (value == 'whatever') {
              //metaData.css : String : A CSS class name to add to the TD element of the cell.
    
              //metaData.attr : String : An html attribute definition string to apply to
    
              //                         the data container element within the table
    
              //                         cell (e.g. 'style="color:red;"').      
    
              metaData.css = 'name-of-css-class-you-will-define';
          }
          return value;
       }
    }

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    So you would use:
    Code:
    renderer: function(value, metaData, record){
      return getProcessedData(value, record.get('colF'), record.get('colG'));
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •