PDA

View Full Version : panel title not changing



nadeemshafi9
22 Jun 2009, 4:56 AM
the title dosent seem to change, thanks for nay sugestions


updateUserPanel = new Ext.Panel({
id: 'updateUserPanel_manageusers_'+m[0].data.id,
listeners: {
beforehide: function(p){
var panel = Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id);
if(panel.getForm().isDirty()){
Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id).setTitle('*'+panel.title);
Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id).doLayout();
Ext.getCmp('manageusersTabs').doLayout()
alert('changed');
}
}
},
title: 'Update User ('+m[0].data.username+')',
header: true,
width: 636,

Condor
22 Jun 2009, 5:41 AM
Could it be that m[0].data.id changes between the time the panel is created and the time beforehide is called?

ps. Are you actually hiding the panel?

nadeemshafi9
22 Jun 2009, 5:47 AM
i hav a card view with different tab panels added to it as teh main content, when i add a panel the panel itself adds tabs to iteself and you can switch between panels in teh card view. so if teh card is already loaded it just shows it rather than loading it again this is for speed. that works fine.


ok what io wanted was to add a listener to each form element but as i am told you cant just expect it to append the config it has to be recreated or before create, unfortunatly i cant append configs before create because there is no such event and i am specifying a long long xtype lazy config.

i wanted a * to appear on form tabs that have been modified but not saved

my solution is as follows



xtype: 'form',
columnWidth: 1,
id: 'updateChanelFormPanel_'+m[0].data.id,
listeners: {
clientvalidation: function(formpanel, isvalid){
var panel = Ext.getCmp('updateChanelPanel_'+m[0].data.id)
if(formpanel.getForm().isDirty()){
if(panel.title.indexOf('*',0)){
panel.setTitle('*'+panel.title);
}
}
else {
panel.setTitle(panel.title.replace('*',''));
}
}
},
monitorValid: true,
border: false,
bodyStyle : 'padding:10px 10px 10px 10px;',
items: [{
xtype: 'hidden',
name: 'id',
value: m[0].data.id
},{
xtype: 'textfield',
name: 'channel_type',
allowBlank: false,
emptyText: 'Channel Type',
fieldLabel: 'Channel Type',
value: m[0].data.channel_type
},{