Created
July 24, 2009 12:56
-
-
Save edspencer/154144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class ExtMVC.view.scaffold.Index | |
* Adds a print button to each grid (remove by setting the hasPrintButton config to false) | |
* | |
* This is an example in support of http://edspencer.net/2009/07/extoverride-monkey-patching-ext-js.html | |
*/ | |
(function() { | |
var originalBuildTopToolbar = ExtMVC.view.scaffold.Index.prototype.buildTopToolbar; | |
Ext.override(ExtMVC.view.scaffold.Index, { | |
hasPrintButton : true, | |
buildTopToolbar: function() { | |
var items = originalBuildTopToolbar.apply(this, arguments); | |
if (this.hasPrintButton === true) { | |
/** | |
* @property printButton | |
* @type Ext.Button | |
* The Print grid button | |
*/ | |
this.printButton = new Ext.Button({ | |
text : 'Print', | |
iconCls: 'print', | |
scope : this, | |
handler: GetIt.GridPrinter.print.createDelegate(this, [this]) | |
}); | |
items.push(this.printButton, '-'); | |
} | |
return items; | |
} | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment