Este es el codigo JS
Código PHP:
Ext.onReady(function(){
//Definimos el almacenamiento
var store = new Ext.data.JsonStore({
url: 'categories.php',
fields: [
{name: 'nombre', type: 'string'}
]
});
store.load();
var simple = new Ext.form.FormPanel({
store: store,
baseCls: 'x-plain',
standardSubmit: true,
labelWidth: 75,
defaultType: 'textfield',
reader: new Ext.data.JsonReader({
root: 'data'
}, ['id','nombre']
),
items: [{
fieldLabel: 'Nombre',
name: 'nombre',
anchor:'80%',
id: 'nombre',
allowBlank:false
}
]
});
//combo.render('combo');
var win = new Ext.Window({
title: 'ComboBox',
width:350,
minWidth:300,
height:300,
minHeight: 200,
resizable: false,
plain: true,
border: false,
items: [simple]
});
win.show();
});
Código PHP:
$nombres = array( "success"=>true ,"data"=>array( "id"=> 1, "nombre"=>"John"));
echo json_encode($nombres);