Estoy empezando a hacer mis primeros formularios con sencha usando el ejemplo Desktop como base de trabajo.
El problema que tengo es que, si bien puedo ejecutar la grilla y el formulario, los datos de la grilla no los puedo ver. Me pueden decir que estoy haciendo mal? muchas gracias.
les acompaño el codigo fuente:
- Código: Seleccionar todo
ABMClientes = Ext.extend(Ext.app.Module, {
id:'abmClientes',
init : function(){
this.launcher = {
text: 'ABM Clientes',
iconCls:'icon-grid',
handler : this.createWindow,
scope: this
}
},
createWindow : function(){
/*Defino el JsonStore*/
var varstore = new Ext.data.JsonStore({
url: 'cargarCombos.php',
root: 'datosProvincias',
sortInfo: {
field: 'provincia',
direction: 'ASC'
},
totalProperty: 'total',
fields: [
{name:'idProvincia'},
{name:'provincia', type: 'string'}
]
});
/* */
var desktop = this.app.getDesktop();
var win = desktop.getWindow('abmClientes');
if(!win){
win = desktop.createWindow({
id: 'abmClientes',
title:'Clientes',
width:740,
height:480,
iconCls: 'icon-grid',
shim:false,
animCollapse:false,
constrainHeader:true,
layout: 'fit',
items:
new Ext.grid.GridPanel({
id: 'grilla',
border:false,
store : varstore ,
columns: [
{
header: "id",
width: 100,
align: 'right',
sortable: false,
dataIndex: 'idProvincia'
},
{
header: "Provincia",
width: 200,
sortable: false,
dataIndex: 'provincia'
}
],
viewConfig: {
forceFit:true
}
/*
,
//autoExpandColumn:'company',
tbar:[{
text:'Add Something',
tooltip:'Add a new row',
iconCls:'add'
}, '-', {
text:'Options',
tooltip:'Blah blah blah blaht',
iconCls:'option'
},'-',{
text:'Remove Something',
tooltip:'Remove the selected item',
iconCls:'remove'
}]
*/
})
});
}
win.show();
}
});
Codigo PHP cargarCombos.php:
- Código: Seleccionar todo
function cargar_provincias(){
$sql = "SELECT * FROM provincias ORDER BY provincia";
$rs = mysql_query($sql) or die;
while($obj = mysql_fetch_object($rs)){
$arr[] = $obj;
}
echo '{"success":true, "datosProvincias":'.json_encode($arr).'}';
}

