A couple of days ago I look for the solution to my problem and nothing, and that is that I am working with java framework Spring MVC with SQL connection and integrated with Extjs 6.2 I try to load the data that returns spring to me within a grid and nothing, you already think the model, store and grid apparently all good but nothing. to see if someone can help me solve it.
Pojo:
public class Aamon {
private int codigo;
private String nombres;
private String carrera;
public Aamon() {
}
public Aamon(int codigo, String nombres, String carrera) {
this.codigo = codigo;
this.nombres = nombres;
this.carrera = carrera;
}
//getter y setter
}
Driver that returns the data in json format.
@ResponseBody
@RequestMapping(value = "/trabajadores", method = RequestMethod.GET)
public Map<String, Object> getAllEmployes() {
Map<String, Object> map = new HashMap<>();
List<Aamon> list = new ArrayList<>();
list.add(new Aamon(10, "Oscar", "Sistemas"));
list.add(new Aamon(20, "Yeghor", "Industrial"));
list.add(new Aamon(30, "Sheyimi", "Docente"));
map.put("success", true);
map.put("message", "Datos encontrados");
map.put("data", list);
return map;
}
My model in extjs:
Ext.define('Pruebita.model.Aamon', {
extend: 'Ext.data.Model',
idProperty: 'codigo',
fields: [
{ name: 'carrerra', type: 'string' },
{ name: 'codigo', type: 'int' },
{ name: 'nombres', type: 'string' }
]
});
My store of extjs:
Ext.define('Pruebita.store.Trabajador', {
extend: 'Ext.data.Store',
alias: 'store.Strabajador',
model: 'Pruebita.model.Aamon',
proxy: {
type: 'ajax',
api: {
read: 'trabajadores'
},
paramsAsJson: true,
reader: {
rootProperty: 'data',
type: 'json'
}
},
autoLoad: true
});
My grid extjs:
Ext.define('Pruebita.view.trabajador.TrabajadorList', {
extend: 'Ext.grid.Panel',
xtype: 'trabajadorList',
store: {
xtype: 'Strabajador'
},
columns: [{
text: 'CODIGO',
dataIndex: 'codigo',
flex: 1
},{
text: 'NOMBRES',
dataIndex: 'nombres',
flex: 1
},{
text: 'CARRERA',
dataIndex: 'carrerra',
flex: 1
}
]
});
Apparently all functions since calling the grid accesses the Spring driver and returns the following:
But as you can see in the grid the data that is returned is not shown.
Thanks in advance for your help.