Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Ext JS 4 Plugin and Extension Development

You're reading from   Ext JS 4 Plugin and Extension Development This book makes it fast and fun for ExtJS developers to get to grips with developing plugins and extensions. The step-by-step instructions, with plentiful examples and code, will give you the skills in no time.

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781782163725
Length 116 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Abdullah Al Mohammad Abdullah Al Mohammad
Author Profile Icon Abdullah Al Mohammad
Abdullah Al Mohammad
Arrow right icon
View More author details
Toc

Planning and coding the chart downloader


The plugin's container may or may not have the bottom bar, so we need to search for the bottom bar within the container. If found, we will use that, otherwise we need to create the bottom bar, and then we can add the download button to that bottom bar.

Now let us start coding for the plugin.

Ext.define('Examples.plugin.ChartDownload', {

  alias : 'plugin.chartdownload',

  config : {
    chartXtype: 'chart',
    downloadButtonText: 'Download as image',
    chartNotFoundErrorMsg: 'No valid chart type found!',
    errorText: 'Error'
  }
…

Here we are providing a configuration option chartXtype so that we can configure this plugin with a proper xtype of the chart, which we are targeting to download as an image. Now let us define the required init function for this plugin:

init : function(container) {

  this.container = container;

  if (!container.rendered) {
    container.on('afterrender', this.handleAfterRender, this);
  } else {
    this.handleAfterRender...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image