Book Image

Ext JS 3.0 Cookbook

Book Image

Ext JS 3.0 Cookbook

Overview of this book

Using Ext JS you can easily build desktop-style interfaces in your web applications. Over 400,000 developers are working smarter with Ext JS and yet most of them fail to exercise all of the features that this powerful JavaScript library has to offer. Get to grips with all of the features that you would expect with this quick and easy-to-follow Ext JS Cookbook. This book provides clear instructions for getting the most out of Ext JS with and offers many exercises to build impressive rich internet applications. This cookbook shows techniques and "patterns" for building particular interface styles and features in Ext JS. Pick what you want and move ahead. It teaches you how to use all of the Ext JS widgets and components smartly, through practical examples and exercises. Native and custom layouts, forms, grids, listviews, treeviews, charts, tab panels, menus, toolbars, and many more components are covered in a multitude of examples.The book also looks at best practices on data storage, application architecture, code organization, presenting recipes for improving themóour cookbook provides expert information for people working with Ext JS.
Table of Contents (15 chapters)
Ext JS 3.0 Cookbook
Credits
About the Author
About the Reviewer
Preface

Embedding a progress bar in a status bar


This recipe explains how to embed a progress bar in a panel's status bar, a scenario found in countless user interfaces:

How to do it...

  1. 1. Create a click handler that will simulate a long-running activity and update the progress bar:

    Ext.onReady(function() {
    var loadFn = function(btn, statusBar) {
    btn = Ext.getCmp(btn);
    btn.disable();
    Ext.fly('statusTxt').update('Saving...');
    pBar.wait({
    interval: 200,
    duration: 5000,
    increment: 15,
    fn: function() {
    btn.enable();
    Ext.fly('statusTxt').update('Done');
    }
    });
    };
    
  2. 2. Create an instance of the progress bar:

    var pBar = new Ext.ProgressBar({
    id: 'pBar',
    width: 100
    });
    
  3. 3. Create a host panel and embed the progress bar in the bbar of the panel. Also, add a button that will start the progress bar updates:

    var pnl = new Ext.Panel({
    title: 'Status bar with progress bar',
    renderTo: 'pnl1',
    width: 400,
    height: 200,
    bodyStyle: 'padding:10px;',
    items: [{
    xtype: 'button',
    id: 'btn',
    text: 'Save',
    width:'75',
    handler:...