PDA

View Full Version : Dynamic Tabtitle



Tascha
4 Nov 2009, 5:07 AM
Hello :)

I want to use dynamic tabtitles, but don't know how...

Dynamic tabtitles means: I load the databasequery into a datastore, everytime it's a different content, f.e. I call the database, the first output is: hostname : WETFGRTER
Next time it's hostname: ERRHGHWER
Etc.

I want the tabtitles displaying the hostnames.
In textfields that works fine:




simple = new Ext.FormPanel({ ///Allgemeine Daten




frame: true,
border: true,
anchor:'100% 80%',




items: [
new Ext.form.FieldSet({

defaultType: 'textfield',
title: 'Device',
collapsible : true,
items: [{

fieldLabel: 'Hostname',
name: 'hostname', <----------works fine
readOnly: true,
width: '291'
}, {
fieldLabel: 'IPv4',
name: 'ipv4_addr',
readOnly: true,
width: '291'
}, {
fieldLabel: 'IPv6',
name: 'ipv6',
readOnly: true,
width: '291'

}]
}),

new Ext.form.FieldSet({

collapsible: true,
title: 'Command Output',
anchor:'100% 80%',
minSize: 400,
border: true,
defaultType: 'label',
items: [aktuell_ListingEditorGrid]

})
]

});



simple.getForm().load({

url:'database.php',
params:{ip: ip_num, task: "GETIP_HOST"}, ////works
method: 'GET',
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);
},
success:function(simple, action) {

}


});



I'm loading text from database directly into the fieldsets...

So now, I tryed it with a tabtitle:




var TabPanel = new Ext.TabPanel({


region: 'center',
activeTab:1,
xtype: 'container',
width: 300,

layoutOnTabChange: true,
items:[{

title: 'Startseite',
iconCls: 'house',
closable:false,
html: '<p></p>'


},{

title: 'hostname', <------------Here I tryed to use the content of the query
iconCls: 'device_view_list',
layout: 'fit',



etc




TabPanel.load({
url:'database.php',
params:{ip: ip_num, task: "GETIP_HOST"},
method: 'GET',
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);
},
success:function(TabPanel, action) {

}


});



The Output in Firefox is correctly:



{success: true, data: {"hostname":"ABCDEFGH"}}


Anyway it doesn't work.
It's quite plain to me, that I use in the tabs the 'title'-attribut, but what else should I take?
'name' isn't available for TabPanels...

Some ideas?

Thanks a lot

Animal
4 Nov 2009, 6:51 AM
Just call setTitle on the Panel. TabPanel will be notified that one of its children has changed title, and update its tab selector text.