PDA

View Full Version : Dinamic Textfields with ComboBox



michelmfreitas
14 Oct 2010, 10:22 AM
Hi!

I'm having a form where the fields are filled according to the ComboBox. The data's fields are originated of mysql database.

The problem is the combobox dont reload, and the data isn't loaded.

Why?

The code:


items:[
{
id: 'combo-tabela',
fieldLabel: 'Menu',
xtype: 'combo',
hiddenName: 'tabela',
store: storeTabelas,
valueField: 'nomeTabela',
displayField: 'tabela',
forceSelection: true,
mode: 'local', //porque carrega localmente o DB
triggerAction: 'all',
onSelect: function(item){
var form = Ext.getCmp('textos-panel');
var combo = Ext.getCmp('combo-tabela');
var tabela = item.data.nomeTabela;
this.collapse();
this.getStore().reload();
this.setValue(item.data.nomeTabela);
if(tabela != ""){
var dados = form.getForm().load({
url: 'classes.php',
params:{
objeto: 'Textos',
metodo: 'Listar',
tabela: tabela
},
method: 'post',
waitTitle: 'Conectando com o Banco de Dados',
waitMsg: 'Carregando...'
});
//alert(dados.data.);
Ext.getCmp('textos-titulo').setValue()
}
}
},{
fieldLabel: 'Título',
name: 'titulo',
maxLenght:200,
id:'textos-titulo'
},{
fieldLabel: 'Texto',
name: 'texto',
xtype: 'htmleditor',
width: 700,
height: 400,
id: 'textos-textarea'
}