1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    55
    Vote Rating
    0
    varunjyoti is on a distinguished road

      0  

    Default Unanswered: Input Box in renderer resets

    Unanswered: Input Box in renderer resets


    Hello

    I have an input box in a grid which i have applied through renderer.
    Code:
    renderer:function(value,metadata,record,rowIndex,colIndex,store,view){
         return '<input type="text" id="contact_email_'+rowIndex +'"/>';
     }
    The problem is that when i perform any action on grid, the renderer gets called and the input box resets. I dont want the input box to get reset once it is rendered. I need some way so that renderer gets called just once or some other kind of solution

    Thanks

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,111
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Is it on the column renderer? That will be called on every reload of the grid at least, because it renders the content.

    Is an Action column no option, if you don't mind the data in the grid?

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    55
    Vote Rating
    0
    varunjyoti is on a distinguished road

      0  

    Default


    tvanzoelen,

    It is a column renderer. Is there a way so that the renderer gets called just once. or is there a way so that the renderer does not perform anything so that input box does not get reset

  4. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,111
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    I think the renderer is supposed to render the column data. It will render if the data if the column changes.

    But you can manupulate its output, its javacode.
    Maybe something like below.
    Code:
    renderer:function(value,metadata,record,rowIndex,colIndex,store,view){
          var item = Ext.get('contact_email_'+rowIndex);
          if(item == undefined)
             return '<input type="text" id="contact_email_'+rowIndex +'"/>';
    }
    But I am not sure if this is the proper way to use the columnrenderer.

    Other possibillity is to set the value property on the <input> if you know its value.

    Is this no option http://docs.sencha.com/ext-js/4-0/#!...plugin.Editing ?

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    55
    Vote Rating
    0
    varunjyoti is on a distinguished road

      0  

    Default


    I already tried what you suggested. It makes the column empty. because renderer then returns empty string.
    I dont want the editor. i just want the textbox at the first place.

    Quote Originally Posted by tvanzoelen View Post
    I think the renderer is supposed to render the column data. It will render if the data if the column changes.

    But you can manupulate its output, its javacode.
    Maybe something like below.
    Code:
    renderer:function(value,metadata,record,rowIndex,colIndex,store,view){
          var item = Ext.get('contact_email_'+rowIndex);
          if(item == undefined)
             return '<input type="text" id="contact_email_'+rowIndex +'"/>';
    }
    But I am not sure if this is the proper way to use the columnrenderer.

    Other possibillity is to set the value property on the <input> if you know its value.

    Is this no option http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.plugin.Editing ?

  6. #6
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,111
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Does it still exist that input item if you do this?

    Code:
    renderer:function(value,metadata,record,rowIndex,colIndex,store,view){
          var item = Ext.get('contact_email_'+rowIndex);
          if(item == undefined)
             return '<input type="text" id="contact_email_'+rowIndex +'"/>';
          else{
              return item; 
           }
    }

Thread Participants: 1