Results 1 to 3 of 3

Thread: call a different renderer function after cell is edited

  1. #1
    Banned
    Join Date
    Feb 2008
    Posts
    47

    Default call a different renderer function after cell is edited

    hi,
    Am pretty new to extjs.i would like to know how i could call a different renderer function after a cell is edited in the EditorGrid.
    Could somebody please help me with this!!


    PHP Code:
    Ext.grid.DynamicColumnModel = function(store){
        var 
    cols = [];
        var 
    recordType store.recordType;
        var 
    fields recordType.prototype.fields;
              
        for (var 
    0fields.keys.lengthi++)
        {
            var 
    fieldName fields.keys[i];
            var 
    field recordType.getField(fieldName);
            
    cols[i] = {headerfield.namedataIndexfield.namewidth:100,
               
    editor: new fm.TextField({
                   
    allowBlanktrue
               
    })};
        }
        
    Ext.grid.DynamicColumnModel.superclass.constructor.call(thiscols);
    };

    Ext.extend(Ext.grid.DynamicColumnModelExt.grid.ColumnModel, {}); 

    this is my afteredit function:

    PHP Code:
    function afterEdit(grid1){
                         
             
    console.log('after edit!!');
                
            
    this.grid=grid1;
                     
                var 
    ed=cm.getCellEditor(0,0);
                         
              var 
    val=ed.getValue();
            
              var 
    valueExt.encode(val);
             var 
    req Ext.Ajax.request({
                
                 
    method:'POST'
                 
    url"try.jsp",
             
    disableCachingfalse,
                 
                 
    params:value
            
                   
              
    callback:function(options,success,response){
                     if(
    success){
                         
    console.log('req sent!');
                    
                     }
                 },
                 
    failure:function(response,options){
                     
    console.log(response.responseText);
                 }
         });
            
              
    alert(value);
                      
                        
        } 

    this is the renderer i want to call after the cell is edited:

    PHP Code:
    function change_font(grid){
                
         
    console.log('inside renderer');                
         
    this.grid=grid;
            
        var 
    ed=cm.getCellEditor(0,0);
        
         var 
    val=ed.getValue();
              
       return 
    '<span style='+fnt_wt+';'+fnt_style+';'+fnt_family+';'+fnt_size+';'+bk_color+';'+fnt_color+'>'+val+'</span>';

            
          } 

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

    Default

    EditorGridPanel already applies the x-grid3-dirty-cell class to the cell if the record is dirty and the field is modified.
    Couldn't you just create a CSS rule that changes the way a cell looks if x-grid3-dirty-cell is on the TD?

    ps. You can find out if a field is modified in the renderer by using:

    Code:
    renderer: function(value, meta, record, row, col, store) {
      var field = store.getColumnMode().getDataIndex(col);
      if (record.dirty && typeof record.modified[field] !== 'undefined') {
        return '<span style="color:red;">' + value + </span>';
      }
      return value;
    }

  3. #3
    Banned
    Join Date
    Feb 2008
    Posts
    47

    Default thanx a lot!! :)

    Thanx a lot,Condor!!!!It worked!!

Posting Permissions

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