PDA

View Full Version : superclass.undefined



Sakafo
26 Feb 2011, 2:34 AM
I have this issue that I can't quite understand with a constructor...

I'm pretty new to ExtJS and most of my code is based on a colleague's code, which is unavailable at the moment...

Basically, I'm creating a tab inside a panel and I'm making it load data through a Web Service, but the whole data collection is fine, it's really just with my tab constructor where it gets messy.

Here's the Tab's code :


// <script>

Ext.ns('Application');
Ext.ns('Application.TurnoverPackage');
Ext.ns('Application.TurnoverPackage.Tabs');

Application.TurnoverPackage.Tabs.SignaturePanel = function(config) {
Ext.apply(this.config);

var signatureFields = [
{ name: 'RequiredSignatureId', type: 'int'},
{ name: 'TurnoverPackageTypeId', type: 'int'},
{ name: 'DepartmentId', type: 'int'},
{ name: 'Department', type: 'string', mapping: 'DepartmentObj.DepartmentName'},
{ name: 'SignedBy', type: 'string'},
{ name: 'DateSigned', type: 'date', dateFormat : "Y-m-d"},
{ name: 'RequiredSignatureComment', type: 'string'}
];

var signatureReader = new Ext.data.JsonReader({
root: 'Root',
fields: signatureFields // Passed params
});

// Le store, qui va contenir tous le data de la grille
var signatureStore = new Ext.data.DirectStore({
reader: signatureReader, // pour lire le data...
sortInfo: {
field: 'Department',
direction: 'DESC' // or 'DESC' (case sensitive for local sorting)
},
api : {
read : WMS.WS_RequiredSignature.getByTurnoverPackageTypeAndSignatures
},
paramOrder : ["turnoverPackageTypeId","turnoverPackageId"]
});

this.signaturePreviewTemplate = new Ext.XTemplate(
'<tpl for=".">',
'<div class="systemPreview-data">',
'<h4 class="systemPreview-subtitle">{Department}</h4>',
'<div class="systemPreview-text">Signed by: {SignedBy}</div>',
'<tpl if="this.define(DateSigned)">',
'<div class="systemPreview-text">Signed on: {DateSigned}</div>',
'</tpl>',
'</div> ',
'</tpl>',
{
define : function(value){
if(value != "NULL" && value != "" && value != null && value != 0)
return true;
else
return false;
},

notDefine : function(value){
if(value == "NULL" || value == "" || value == null || value == 0)
return true;
else
return false;
}
}
);

this.signaturePanel = new Ext.Panel({
cls:'systemPreview',
region : 'north',
height: 280,
loadMask: { msg: "<?=_("Loading Signatures...")?>" },
style : 'padding-bottom : 5px;',
autoScroll: true,
tbar: [{
text: "<?=_("View in New Tab")?>",
iconCls: 'silk-tab-add',
ref : 'btnViewNewTab',
disabled:true,
handler : function() {
WMS.MessageBus.publish("SystemOpenTab", null, 0);
},
scope: this
}],
viewConfig : {
forceFit: true,
emptyText: "<?= _("This turnover package has no signatures."); ?>"
},
items: new Ext.DataView({
html : '<h3 class="systemPreview-title"><img class = "systemPreview-icon" src="images/Icons/silk/page_edit.png"/> <?=_("Signatures")?><hr/></h3>',
ref: 'dataview',
store: signatureStore,
tpl: this.signaturePreviewTemplate,
autoHeight: true,
disable: true,
emptyText: 'There are no signatures for this package'
})
});

// l'initialisation de l'objet en tant que tel
Application.TurnoverPackage.Tabs.SignaturePanel.superclass.constructor.call(this, {
store : signatureStore,
cm : cm,
tbar : new Ext.Toolbar(),
autoHeight : true,
style : 'padding : 5px 0px 5px 0px;',
title : '<?=_("Signature")?>(s)',
loadMask: { msg: "<?=_("Loading Signatures ...")?>" },
viewConfig: {
forceFit:true,
emptyText: "<?=_("This turnover package requires no signatures.")?>"
}
});


// Gestion d'Evenements
this.on("afterrender", function() {
this.getStore().setBaseParam("turnoverPackageTypeId", this.record.data.TurnoverPackageTypeId);
this.getStore().setBaseParam("turnoverPackageId", this.record.data.TurnoverPackageId);
this.getStore().load();

//this.buildToolbarItems();
}, this);

};
Ext.reg('signaturepanel', Application.TurnoverPackage.Tabs.SignaturePanel);

//</script>And here is the code that calls this tab...



// Just showing the code calling the tab
Application.TurnoverPackage.Tabs.SignatureMainPanel = function(config){
Ext.apply(this.config);

this.SigPanel = new Ext.Panel({
region: 'center',
margins : '2 2 2 2',
autoScroll : true,
bodyStyle : 'padding : 10px; color:#666666; font-size : 14px',
tbar : new Ext.Toolbar()
});

// l'initialisation de l'objet en tant que tel
Application.TurnoverPackage.Tabs.SignatureMainPanel.superclass.constructor.call(this, {
title : '<?=_("Signature")?>(s)',
iconCls : 'silk-application-form-edit',
border : false,
items : this.SigPanel
});


// Gestion d'Evenements
this.SigPanel.on("render", this.onRenderSig, this);
}

//...

Ext.extend(Application.TurnoverPackage.Tabs.SignatureMainPanel, Ext.TabPanel, {

//...

onRenderSig : function(panel) {
panel.body.mask("<?=_("Loading Signatures...")?>");
debugger;
if (record.data.TurnoverPackageTypeId && record.data.TurnoverPackageId) {
WMS.WS_RequiredSignature.getByTurnoverPackageTypeAndSignatures(record.data.TurnoverPackageTypeId, record.data.TurnoverPackageId, function(response) {
if (response.TotalCount > 0) {
debugger;
panel.add({
xtype : 'signaturepanel',
record : record
});
debugger;
panel.doLayout();
this.buildToolbarItems();
} else {
panel.body.update("No signatures were found for this system. You either need to assign a Type to your Turnover Package, or you need to assign the required signatures to that Type.");
}
panel.body.unmask();
}, this);
} else {
panel.body.unmask();
panel.body.update("<?=_("No warecode selected. Please add a warecode to the system.")?>");
}
}
});



Firebug reports a crash at the Tab's constructor
Application.TurnoverPackage.Tabs.SignaturePanel.superclass.constructor.call)

and by putting breakpoints you can see it crashes after adding the tab to the panel...


panel.add({
xtype : 'signaturepanel',
record : record
});

So any help will be really appreciated, I hope my issue is clear enough for you.. it's not really clear for me =P

Thanks in advance!