Threaded View

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    21
    Vote Rating
    0
    Answers
    1
    nakul_sagar is on a distinguished road

      0  

    Default Answered: how to change button color when perform onclick in sencha touch

    Answered: how to change button color when perform onclick in sencha touch


    can any1 please help me , how to get change button color (button which is present in toolbar)when user perform onClick ..

    my code is shown below:
    var mytop1 = new Ext.Toolbar({
    dock: 'top' ,
    scroll:'horizontal',
    directionLock: false,
    height:'20%',
    layout: {
    pack:'center',
    },

    items:[


    {
    xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/overview.jpg" width="100%" height="100%" onclick="overview_func();" /><font size="1%">Overview</font></div>',
    },
    {
    xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/weight.jpg" width="100%" height="100%" onclick="weight_func();"/><font size="1%">Weight</font></div>',
    },
    {
    xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/bp.jpg" width="100%" height="100%" onclick="bp_func();"/><font size="1%">BP</font></div>',
    },
    {
    xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/spo2.jpg" width="100%" height="100%" onclick="spo2_func();"/><font size="1%">spo2</font></div>',
    },
    {
    xtype:'button',
    height:'80%',

    html: '<div align="center"><img src="img/glucose.jpg" height="50%" onclick="glucose_func();"/><font size="1%">Glucose</font></div>',

    },
    {xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/spiro.jpg" width="100%" height="100%" onclick="spiro_func();"/><font size="1%">Spiro</font></div>',
    },
    {xtype:'button',
    style:{float: 'left',},
    height:'80%',
    html: '<div align="center"><img src="img/medinfo.jpg" width="100%" height="100%" onclick="medinfo_func();"/><font size="1%">Medinfo</font></div>',
    },



    ],


    });



    return mytop1;



    thanks in advance
    Last edited by nakul_sagar; 23 Apr 2012 at 11:50 PM. Reason: addition of code

  2. Once again you shouldn't use onclick attribute. You can set a listener to the element:

    Code:
    comp.element.on({
        scope : comp,
        delegate : 'img',
        tap : function(e) {....}
    });

Thread Participants: 1