Results 1 to 2 of 2

Thread: renderTo and this.control in controller

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium Member
    Join Date
    Jun 2007
    Location
    Ostrava, Czech Republic
    Posts
    43
    Vote Rating
    3
      0  

    Default Unanswered: renderTo and this.control in controller

    Hi,

    I have dataview with tpl. In controller refresh event of dataview is catched and Ext.form.Panel with textarea and button are added. Till now OK. Controller is subscribed to dynamically added components, so this.reply is called when button click is fired.

    Is there way how to use query widgetpost button[action="reply"] or widgetpost dataview button[action="reply"] ... instead of only button[action="reply"]?

    Component is rendered to DOM and due to this there is probably no "connection" with widgetpost but I dont want to mess up "global namespace" with common word / buttons actions like reply, send.

    PHP Code:
    // init and set controll
    init:function () {
            
    this.control({
                
    'widgetpost dataview':{
                    
    itemclick:this.itemClickWidgetDataView,
                    
    refresh:this.refresh
                
    },
                
    'button[action="reply"]':{
                    
    click:this.reply
                
    }
            });
        },

    // reply function
    reply: function(me) {
            
    alert(me);
    },

    // refresh function
    refresh:function (me) {
            var 
    renderSelector Ext.query('.commentTextArea');
            for (var 
    i in renderSelector) {
                
    Ext.create('Ext.form.Panel', {
                    
    renderTo:Ext.get(renderSelector[i]),
                    
    border:false,
                    
    layout:{
                        
    type:'hbox'
                    
    },
                    
    items:[
                        {
                            
    xtype:'textarea',
                            
    height:20
                        
    },
                        {
                            
    xtype:'button',
                            
    text:'reply',
                            
    action:'reply'
                        
    }
                    ]
                });
            }
        }, 

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,389
    Answers
    716
    Vote Rating
    498
      0  

    Default

    Sure.. you can qualify using your alias name from your view:

    'app-list-users button[action=addUser]' : {
    click : me.addUser
    },
    Scott.

Tags for this Thread

Posting Permissions

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