1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    48
    Vote Rating
    0
    kjcr is on a distinguished road

      0  

    Default Unanswered: button in template

    Unanswered: button in template


    three more days make me to modify this code
    but i fail.
    HTML Code:
    '<tpl if="this.checkValue(values.type)">',         
    + '<dl style="display:inline-block;width:100px;color:red;font-weight:bold;padding-left:20px;">'
    +'{[values.type.toUpperCase()]}'+']</dl>',          
    '<div style="display:inline-block;float:right;padding-right:5px;"><input type="button" id="showXML" style="width:50px" value="Edit"/></div>',          
    '</tpl>'
    and i make
    HTML Code:
    Ext.getCmp('showXML').on('click',function(){//mycode})
    i fail this code,

    and i try another,

    HTML Code:
    <input type="button" onclick=[{this.myfunction()}] id="showXML" style="width:50px" value="Edit"/>
    and i fail, too.

    is there any solution about this?

  2. #2
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    48
    Vote Rating
    0
    kjcr is on a distinguished road

      0  

    Default ...

    ...


    do you know anything about this?

    i use
    HTML Code:
    $('.className').bind({
    click:function(){
    //mycode
    }})
    and also use

    HTML Code:
    listeners:{                afterrender:function(aa, eOpts ){                    var id = Ext.id();                    var component = Ext.get(id);                    component.on('click', function(component) {                       console.log('hhhhh');                    });
    }
    but none of these work.
    please help me.

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,589
    Vote Rating
    434
    Answers
    3102
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Code:
    listeners : {
        element : 'element',
        delegate : 'input[type=button]',
        tap : function() {}
    }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2012
    Posts
    48
    Vote Rating
    0
    kjcr is on a distinguished road

      0  

    Default thanx

    thanx


    but it didnot work.

    so I solve this problem other way

    HTML Code:
     var valPanel = Ext.create('Ext.view.View',{
        store:project_val,
          id:'gridVal',
          style:{
           background:'#ffffff'
          },
          emptyText:'There is no Data',
          tpl:tpl,
          itemSelector:'div.thumb-wrap',
          listeners:{
           itemclick:function(view, e, item, index) {
                         console.log(index);
           }
           }
          }
         });
    and my template

    HTML Code:
    '<tpl for=".">',
         '<div style="padding-top:10px;border-bottom:1px solid #e9e5e5;padding-bottom:10px;">',
            '<tpl if="this.checkValue(values.type)">',
         '<dl style="display:inline-block;width:100px;color:red;font-weight:bold;padding-left:20px;">&#45;['+'{[values.type.toUpperCase()]}'+']</dl>',
         '<div class="thumb-wrap" style="display:inline-block;float:right;padding-right:5px;"><a id="test" class="showXML" href="#"><img src="images/edit.png"></a></div>',
         '</tpl>',
        
        '<tpl if="this.checkValue2(values.type)">',
         '<dl style="display:inline-block;width:100px;color:blue;font-weight:bold;padding-left:20px;">&#45;['+'{[values.type.toUpperCase()]}'+']</dl>',
         '<div class="thumb-wrap" style="display:inline-block;float:right;padding-right:5px"><a class="showXML" href="#"><img src="images/edit.png"></a></div>',
        '</tpl>',
        '<dt style="display:inline">{title}</dt>',
        '<dt style="padding-left:30px;">{message}</dt>',
        '</div>',
       '</tpl>'
    this is work^^