1. #1
    Sencha User
    Join Date
    Dec 2012
    Location
    India
    Posts
    2
    Vote Rating
    0
    tshivanand is on a distinguished road

      0  

    Default Unanswered: Regarding tpl button eventhndler

    Unanswered: Regarding tpl button eventhndler


    Hi,
    i am shivanad tripathi new in extjs i have one template which have to button edit and delete and i am using html code for creating button but i want that button on controller so how to get that button on controller based on button id .
    i am sending my screen shot and code also.
    tpl : new Ext.XTemplate(
    '<tpl for=".">',
    '<div class="thumb-wrap">',
    '<div class="thumb">',
    (!Ext.isIE6
    ? '<img src="http://192.168.1.229/mailtrack-svc/service/image-service/getImageData/template/{name}" height="90" width="90" />'
    : '<div style="filter:progidXImageTransform.Microsoft.AlphaImageLoader(src=\'http://localhost/mailtrack-svc/service/image-service/getImageData/template/{name}\')"></div>'),
    '</div>', '<span><input type=button value=Edit onclick="Editbutton" id="Editbutton">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</span>', '<span><input type=button value=Delete>&nbsp&nbsp</span>', '</div>', '</tpl>'),
    handler: function(values) {
    var id = Ext.id();
    alert("idclcik"+id);
    Ext.Function.defer(this.addListener, 1, this, [id])
    return id;
    },
    listener: function() {
    Ext.getCmp('Editbutton').on('click',function(){
    alert("editclcik");
    });
    }
    Thanks&Regards,
    Shivanand
    });
    var categoriesList = Ext.create('lib.Commons.Components.Containers.MailTrackFieldSet',{
    border:false,


    items : [
    Categories
    ],
    });
    Attached Images

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You have to add element listeners to it...

    Code:
    view.el.on('click', someFunction, view, { delegate : 'button' });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1