Switching between multiple views using SegmentedButton

This recipe describes the usage of the SegmentedButton component, which is generally a part of the toolbar and is useful in switching between different views.

Getting ready

Make sure that you have set up your development environment by following the recipes outlined in Chapter 1.

How to do it...

  1. Create and open a new file named ch06_09.js and paste the following code in it:
    Ext.setup({ onReady: function() { var segmentedButton = new Ext.SegmentedButton({ renderTo: Ext.getBody(), items: [ { text: 'Album' }, { text : 'About', pressed: true }, { text: 'Help' } ], listeners: { toggle: function(container, button, pressed){ console.log("User toggled the '" + button.text + "' button: " + (pressed ? 'on' ...

Get Sencha Touch Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.