icebergdelphi
6 Apr 2012, 6:04 PM
Hello, I have a doubt, the ux.searchfield not work properly in MVC environment, if i assign the grid store, to make a query, an error rise in searchfield: Store.getProxy is not a function, but if I make an instance of the Store it works perfectly. So is a bug or how I can solve this problem?
Thanks and i hope you can help me.:-?
this is My MVC Code with no Store Instance, and the SearchField Rise an error:Store.getProxy is not a function
Ext.define('Mocaci.view.Ciudadanos.GrdCiudadanos',{
extend: 'Ext.grid.Panel',
alias:'widget.gridCiudadanos',
store:'Ciudadanos.Ciudadanos', ////MVC an inside Controller
border: false,
listeners: {
'selectionchange': function(view, records) {
this.down('#delete').setDisabled(!records.length);//Se Habilita el Boton Delete
}
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns : [//Definimos las Columnas del Grid y las Columnas de la Tabla
{header:"Id",dataIndex:"IdCiudadano",flex:1,hidden:true},
{header:"CURP",dataIndex:"Curp",flex:1},
{header:"IFE",dataIndex:"IFE",flex:1},
{header:"Ape. Paterno",dataIndex:"apellidop",flex:1},
{header:"Ape. Materno",dataIndex:"apellidom",flex:1},
{header:"Nombre",dataIndex:"nombre",flex:1}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
itemId: 'Add',
text: 'Agregar',
iconCls: 'add',
action:'actAgregar'//Accion manejado por el Controlador
},'-',{
itemId: 'edit',
text: 'Editar',
iconCls: 'edit',
scope: this,
action:'actEditar'
},'-',{
itemId: 'delete',
text: 'Borrar',
iconCls: 'delete',
disabled: true,
action:'actBorrar' //Accion manejado por el Controlador
},'-',{
xtype: 'searchfield',
emptyText: 'Buscar Por Nombres',
store:me.store,
params: {start: 0, limit: 100 },
width: 400,
fieldLabel: 'Buscar',
labelWidth: 50
}
]
},
{
xtype: 'pagingtoolbar',//Barra Paginadora al fondo del Grid
dock: 'bottom',
displayInfo: true,
store:me.store
}
],
});
me.callParent(arguments);
me.store.load({//Cargamos el Store, al crear la ventana
params:{
start:0,
limit: 100 //Muestra hasta 100 Registros Maximo
}
});
}
});
This is My code with a store instance, with this code the searchfield works perfectly, but some times, not alwalys, the instance of the store rise a new error C is not a constructor:
var storeCiudadanos=Ext.create('Mocaci.store.Ciudadanos.Ciudadanos'); // New Instance.
Ext.define('Mocaci.view.Ciudadanos.GrdCiudadanos',{
extend: 'Ext.grid.Panel',
alias:'widget.gridCiudadanos',
store:storeCiudadanos, //'Ciudadanos.Ciudadanos', //Store with new instance.
border: false,
listeners: {
'selectionchange': function(view, records) {
this.down('#delete').setDisabled(!records.length);//Se Habilita el Boton Delete
}
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns : [//Definimos las Columnas del Grid y las Columnas de la Tabla
{header:"Id",dataIndex:"IdCiudadano",flex:1,hidden:true},
{header:"CURP",dataIndex:"Curp",flex:1},
{header:"IFE",dataIndex:"IFE",flex:1},
{header:"Ape. Paterno",dataIndex:"apellidop",flex:1},
{header:"Ape. Materno",dataIndex:"apellidom",flex:1},
{header:"Nombre",dataIndex:"nombre",flex:1}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
itemId: 'Add',
text: 'Agregar',
iconCls: 'add',
action:'actAgregar'//Accion manejado por el Controlador
},'-',{
itemId: 'edit',
text: 'Editar',
iconCls: 'edit',
scope: this,
action:'actEditar'
},'-',{
itemId: 'delete',
text: 'Borrar',
iconCls: 'delete',
disabled: true,
action:'actBorrar' //Accion manejado por el Controlador
},'-',{
xtype: 'searchfield',
emptyText: 'Buscar Por Nombres',
store:me.store,
params: {start: 0, limit: 100 },
width: 400,
fieldLabel: 'Buscar',
labelWidth: 50
}
]
},
{
xtype: 'pagingtoolbar',//Barra Paginadora al fondo del Grid
dock: 'bottom',
displayInfo: true,
store:me.store
}
],
});
me.callParent(arguments);
me.store.load({//Cargamos el Store, al crear la ventana
params:{
start:0,
limit: 100 //Muestra hasta 100 Registros Maximo
}
});
}
});
Thanks and i hope you can help me.:-?
this is My MVC Code with no Store Instance, and the SearchField Rise an error:Store.getProxy is not a function
Ext.define('Mocaci.view.Ciudadanos.GrdCiudadanos',{
extend: 'Ext.grid.Panel',
alias:'widget.gridCiudadanos',
store:'Ciudadanos.Ciudadanos', ////MVC an inside Controller
border: false,
listeners: {
'selectionchange': function(view, records) {
this.down('#delete').setDisabled(!records.length);//Se Habilita el Boton Delete
}
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns : [//Definimos las Columnas del Grid y las Columnas de la Tabla
{header:"Id",dataIndex:"IdCiudadano",flex:1,hidden:true},
{header:"CURP",dataIndex:"Curp",flex:1},
{header:"IFE",dataIndex:"IFE",flex:1},
{header:"Ape. Paterno",dataIndex:"apellidop",flex:1},
{header:"Ape. Materno",dataIndex:"apellidom",flex:1},
{header:"Nombre",dataIndex:"nombre",flex:1}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
itemId: 'Add',
text: 'Agregar',
iconCls: 'add',
action:'actAgregar'//Accion manejado por el Controlador
},'-',{
itemId: 'edit',
text: 'Editar',
iconCls: 'edit',
scope: this,
action:'actEditar'
},'-',{
itemId: 'delete',
text: 'Borrar',
iconCls: 'delete',
disabled: true,
action:'actBorrar' //Accion manejado por el Controlador
},'-',{
xtype: 'searchfield',
emptyText: 'Buscar Por Nombres',
store:me.store,
params: {start: 0, limit: 100 },
width: 400,
fieldLabel: 'Buscar',
labelWidth: 50
}
]
},
{
xtype: 'pagingtoolbar',//Barra Paginadora al fondo del Grid
dock: 'bottom',
displayInfo: true,
store:me.store
}
],
});
me.callParent(arguments);
me.store.load({//Cargamos el Store, al crear la ventana
params:{
start:0,
limit: 100 //Muestra hasta 100 Registros Maximo
}
});
}
});
This is My code with a store instance, with this code the searchfield works perfectly, but some times, not alwalys, the instance of the store rise a new error C is not a constructor:
var storeCiudadanos=Ext.create('Mocaci.store.Ciudadanos.Ciudadanos'); // New Instance.
Ext.define('Mocaci.view.Ciudadanos.GrdCiudadanos',{
extend: 'Ext.grid.Panel',
alias:'widget.gridCiudadanos',
store:storeCiudadanos, //'Ciudadanos.Ciudadanos', //Store with new instance.
border: false,
listeners: {
'selectionchange': function(view, records) {
this.down('#delete').setDisabled(!records.length);//Se Habilita el Boton Delete
}
},
initComponent: function() {
var me = this;
Ext.applyIf(me, {
columns : [//Definimos las Columnas del Grid y las Columnas de la Tabla
{header:"Id",dataIndex:"IdCiudadano",flex:1,hidden:true},
{header:"CURP",dataIndex:"Curp",flex:1},
{header:"IFE",dataIndex:"IFE",flex:1},
{header:"Ape. Paterno",dataIndex:"apellidop",flex:1},
{header:"Ape. Materno",dataIndex:"apellidom",flex:1},
{header:"Nombre",dataIndex:"nombre",flex:1}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
itemId: 'Add',
text: 'Agregar',
iconCls: 'add',
action:'actAgregar'//Accion manejado por el Controlador
},'-',{
itemId: 'edit',
text: 'Editar',
iconCls: 'edit',
scope: this,
action:'actEditar'
},'-',{
itemId: 'delete',
text: 'Borrar',
iconCls: 'delete',
disabled: true,
action:'actBorrar' //Accion manejado por el Controlador
},'-',{
xtype: 'searchfield',
emptyText: 'Buscar Por Nombres',
store:me.store,
params: {start: 0, limit: 100 },
width: 400,
fieldLabel: 'Buscar',
labelWidth: 50
}
]
},
{
xtype: 'pagingtoolbar',//Barra Paginadora al fondo del Grid
dock: 'bottom',
displayInfo: true,
store:me.store
}
],
});
me.callParent(arguments);
me.store.load({//Cargamos el Store, al crear la ventana
params:{
start:0,
limit: 100 //Muestra hasta 100 Registros Maximo
}
});
}
});