-
6 May 2009 4:27 PM #1
How to remove/delete some property of some class
How to remove/delete some property of some class
Hi all,
I am new to extjs. Please help me . i have a tab panel and within that panel I have a form.
I basically have 2 classes
1) myTabPanel
2) myFormPanel
I have embedded myFormPanel inside myTabPanel.
Now since i want to reuse my classes. i want to have the formPanel to have a predefined title
but I dont want to have it when I use it from tabpanel as tabpanel has one of its own.
below is my sample code
myFormPanel = Ext.extend(Ext.form.FormPanel, {
labelWidth : 75,
frame : false,
defaultType : 'textfield',
title : 'hello',
/*
........
.....
});
myTabPanel = Ext.extend(Ext.TabPanel, {
layout : 'border',
title : 'Create Case',
frame : true,
bodyBorder : false,
form : new myFormPanel(),
initComponent : function() {
this.form.title = null;
//The above line does not help...Basically I want to check if myTabPanel has title I dont want title in the formPanel. But I want to have it in the Class since I may want it to be used somwhere else..Also wat happens when I make it null there is a small line rendered on the top of the form which is annoying
Can someone please help
-
6 May 2009 4:47 PM #2
Your problem has nothing to do with Ext JS. What you need is is delete operator in JavaScript.
https://developer.mozilla.org/en/Cor...elete_OperatorEugene
Ext.Direct for ASP.NET MVC
-
6 May 2009 4:56 PM #3
Pass a config when you create your formPanel something like "inform: true". You can then check that in your formPanel whether you want title or not. So your formPanel code will change like this:
Code:myFormPanel = Ext.extend(Ext.form.FormPanel, { labelWidth : 75, frame : false, defaultType : 'textfield', // don't add the title here //title : 'hello', initComponent: function(){ if(this.inForm){ this.header = false; }else{ this.title = "hello"; } // any other default properties you want to apply Ext.apply(this, {}); } /* ........ ..... });


Reply With Quote