构建后的商店实例不起作用

时间:2015-12-15 15:47:49

标签: extjs build store extjs6

我有商店:

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'
        } 
    }
});

模特:

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"     // 
    ]
});

我有网格:

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
        };
    }
});

当我实例化网格时,在开发模式下,一切正常,但在构建之后我遇到了问题:

GET http://localhost:8080/SamosGaz/build/production/SamosGaz/.js?_dc=20151215132801 404 (Not Found) Uncaught TypeError: c is not a function (click for image)

我需要做出哪些改变?

好奇地,我改变了ajax的代理,而不是休息和它的工作;但我怎么能用rest代理呢?

1 个答案:

答案 0 :(得分:1)

如果您正在使用Sencha Cmd进行构建,请尝试进行测试构建,即“sencha app build testing”,而不是通常的“sencha app build”。这将为您提供未压缩Javascript的构建,以便错误报告更清晰。

更具体地说 - 当框架试图加载“.js”文件时,通常是因为你错过了“require”语句。我怀疑你需要的“SamosGaz.store.consulta.VendasFaturamento”课程:

requires: [
"SamosGaz.model.consulta.VendasFaturamento"
]

也可能还有其他一些人。测试版本将为您提供更好的错误。