PDA

View Full Version : Unable to destroy grid.panel



art.com
15 Jul 2013, 1:59 AM
I'm not able to figure this one out. Anyone an idea?

I've got the following view, which I want to destroy after printing it using ux-gridprinter (https://github.com/loiane/extjs4-ux-gridprinter). But my console keeps telling me that destory is not a function.

The code:

store.load({
scope: this,
callback: function(records, operation, success){
var grid = Ext.create('framedash.view.print.empPlan');
Ext.ux.grid.Printer.printAutomatically = true;
Ext.ux.grid.Printer.mainTitle = 'Employee planning ' + Ext.Date.format(date, 'l d-m-Y');
Ext.ux.grid.Printer.print(grid);

grid.destroy();
}
});

The view:

Ext.define('framedash.view.print.empPlan', {
extend: 'Ext.grid.Panel',
alias: 'widget.printEmpPlan',

title: 'Employee planning',
forceFit: true,
store: 'plan.empPlanDaily',

initComponent: function() {
var me = this;

Ext.applyIf(me, {
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'first_name',
menuDisabled: true,
text: 'First name'
},
{
xtype: 'gridcolumn',
dataIndex: 'name',
menuDisabled: true,
text: 'Name'
},
{
xtype: 'gridcolumn',
align: 'right',
dataIndex: 'department',
menuDisabled: true,
text: 'Department'
},
{
xtype: 'gridcolumn',
dataIndex: 'task_name',
menuDisabled: true,
text: 'Task'
},
{
xtype: 'gridcolumn',
dataIndex: 'start_time',
text: 'Start time'
},
{
xtype: 'gridcolumn',
dataIndex: 'end_time',
menuDisabled: true,
text: 'End time'
},
{
xtype: 'gridcolumn',
dataIndex: 'break_time',
text: 'Break'
}
]
});

me.callParent(arguments);
}

});

art.com
15 Jul 2013, 2:07 AM
Fixed! Spelling mistake. D'OH!!:((