I have the store:
Ext.define('SamosGaz.store.consulta.VendasFaturamento', {
extend: 'Ext.data.Store',
model: 'SamosGaz.model.consulta.VendasFaturamento',
alias: 'store.vendasfaturamento',
remoteSort: true,
groupField: 'SUBGRUPO_DESCRICAO',
proxy: {
type: 'rest',
noCache: false,
url: 'http://cambioparts.no-ip.info:8050/app/MyInterface/consultas',
reader: {
type: 'json',
rootProperty: 'result[0].rows',
successProperty: 'result[0].success',
totalProperty: 'result[0].total'
}
}
});
The model:
Ext.define('SamosGaz.model.consulta.VendasFaturamento', {
extend: 'Ext.data.Model',
fields: [
"SUBGRUPO", // "00001",
"SUBGRUPO_DESCRICAO", // "EUROTECNICA",
"GRUPO", // "00004",
"GRUPO_DESCRICAO", // "CAIXA DE CAMBIO",
"VENDAS_BRUTA", //
"VENDAS_DEVOLUCAO", //
"VENDAS_LIQUIDA", //
"VENDAS_FRETE", //
"VENDAS_OUTROS", // 0,
"VENDAS_TOTAL", //
"VENDAS_CUSTO", //
"VENDAS_MARGEM", //
"VENDAS_PARTICIPACAO",//
"COMPRAS_BRUTA", //
"COMPRAS_IMPOSTOS", //
"COMPRAS_TOTAL", //
"COMPRAS_DEVOLUCAO", // ,
"COMPRAS_LIQUIDO" //
]
});
And I have the grid:
Ext.define('SamosGaz.view.consulta.vendasfaturamento.VendasFaturamento', {
extend: 'Ext.grid.Panel',
xtype: 'vendasfaturamento',
title: 'Vendas Faturamento',
module: 'consulta',
requires: [
'SamosGaz.store.consulta.VendasFaturamento',
'SamosGaz.view.consulta.vendasfaturamento.VendasFaturamentoController'
],
controller: 'vendasfaturamento',
columnLines: true,
store: {
type: 'vendasfaturamento'
},
initComponent: function () {
var me = this;
Ext.apply(me, {
features: [
{
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: true,
enableGroupingMenu: false
},
{
ftype: 'summary',
dock: 'bottom'
}
],
columns: [
{
text: 'Ord',
align: 'center',
width: 50,
menuDisabled: true,
hideable: false,
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
return rowIndex + 1
}
},
{
text: 'Descrição',
dataIndex: 'GRUPO_DESCRICAO',
flex: 1,
menuDisabled: true,
hideable: false,
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>Total</strong>';
}
},
{
header: 'Vendas',
columns: [
{
header: 'Venda',
dataIndex: 'VENDAS_BRUTA',
xtype: 'moneycolumn',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Devolução',
dataIndex: 'VENDAS_DEVOLUCAO',
xtype: 'moneycolumn',
width: 110,
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Líquida',
dataIndex: 'VENDAS_LIQUIDA',
xtype: 'moneycolumn',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Frete',
dataIndex: 'VENDAS_FRETE',
xtype: 'moneycolumn',
width: 80,
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Outros',
dataIndex: 'VENDAS_OUTROS',
xtype: 'moneycolumn',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Total',
dataIndex: 'VENDAS_TOTAL',
xtype: 'moneycolumn',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'Custo',
dataIndex: 'VENDAS_CUSTO',
xtype: 'moneycolumn',
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: 'MG',
dataIndex: 'VENDAS_MARGEM',
xtype: 'moneycolumn',
width: 80,
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
},
{
header: '% Par',
dataIndex: 'VENDAS_PARTICIPACAO',
xtype: 'moneycolumn',
width: 80,
summaryType: 'sum',
summaryRenderer: function(value, summaryData, dataIndex) {
return '<strong>' + Ext.ux.String.toMoney(value) + '</strong>'
}
}
]
}
],
tbar: [
{
fieldLabel: 'Data Inicial',
xtype: 'datesearch',
itemId: 'dataInicial',
value: Ext.ux.Date.firstMonthDate(),
listeners: {
change: 'setDataFinal'
}
},
{
fieldLabel: 'Data Final',
xtype: 'datesearch',
itemId: 'dataFinal',
value: Ext.ux.Date.lastMonthDate(),
listeners: {
change: 'setDataInicial'
}
},
'-',
{
xtype: 'button',
text: 'Pesquisar',
listeners: {
click: 'pesquisar'
}
}
]
});
this.callParent(arguments);
this.getStore().listeners = {
load: me.controller.updateBottomBar
};
}
});
When I instantiate the grid, in developing mode, everything is ok, but after build I have the issue:
What kind of change i need to make??
curiously, i change the proxy for ajax, instead rest and its work; but how can I do it with rest proxy ?
If you're using Sencha Cmd to do the build try making a testing build ie "sencha app build testing" instead of the usual "sencha app build". This will give you a build where the Javascript is not compressed so the error report will be clearer.
More specifically - when the framework is trying to load ".js" files it's usually because you're missing a "requires" statement. I suspect in your "SamosGaz.store.consulta.VendasFaturamento" class you need:
requires: [
"SamosGaz.model.consulta.VendasFaturamento"
]
And possibly some others as well. The testing build will give you better errors.