Q:

how to highlight buttons in extjs when clicking on it

items: [{
    xtype: 'button',
    text: 'Today',
    ui:'default-toolbar',
    margin: '10 10 10 10'
},{
    xtype: 'button',
    text: 'Yesterday',
    ui:'default-toolbar',
    margin: '0 10 10 10'

    }
},{
    xtype: 'button',
    text:'Last 7 days',
    ui:'default-toolbar',
    margin: '0 10 10 10'
}, {
    xtype: 'button',
    text: 'Last Month',
    ui:'default-toolbar',
    margin: '0 10 10 10'

}]

A:

Ext.Button have a property enableToggle which if set to true will apply pressedCls to the button when clicked and remove the pressedCls when pressed again.
Sample Code:

Ext.application({
  name: 'Fiddle',

  launch: function() {
    Ext.create('Ext.Container', {
      renderTo: Ext.getBody(),
      items: [{
        xtype: 'button',
        text: 'My Button',
        enableToggle: true
      }]
    });
  }
});
<link rel="stylesheet" href="https://cdn.sencha.com/ext/gpl/4.1.1/resources/css/ext-all.css">
<script type="text/javascript" src="https://cdn.sencha.com/ext/gpl/4.1.1/ext-all-debug.js"></script>

For Multiple Button:
When we need to toggle pressedCls between mutiple button.We need to use toggleGroup property of button. It will toggle the pressedCls among multiple where same toggleGroup is given.
Sample Code:

Ext.application({
  name: 'Fiddle',

  launch: function() {
    Ext.create('Ext.Container', {
      renderTo: Ext.getBody(),
layout:'vbox',
      items: [{
        xtype: 'button',
        text: 'Today',
        enableToggle: true,
        toggleGroup:'myButtonGroup'
      },{
        xtype: 'button',
        text: 'Yesterday',
        enableToggle: true,
        toggleGroup:'myButtonGroup'
      },
      {
        xtype: 'button',
        text: 'Last 7 days',
        enableToggle: true,
        toggleGroup:'myButtonGroup'
      }]
    });
  }
});
<link rel="stylesheet" href="https://cdn.sencha.com/ext/gpl/4.1.1/resources/css/ext-all.css">
<script type="text/javascript" src="https://cdn.sencha.com/ext/gpl/4.1.1/ext-all-debug.js"></script>

