首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Extjs Store更新

Extjs Store更新
EN

Stack Overflow用户
提问于 2014-02-13 07:07:03
回答 1查看 770关注 0票数 0

我有一个带有静态存储的网格,我想添加一个记录以在该网格中显示它,但是当我尝试将它添加到存储中时,网格不显示它。

我已经为网格列添加了一个FilterFeature

商店是这样的:

代码语言:javascript
复制
var store_tipo_ingreso = Ext.create('Ext.data.Store', {
    storeId:'ingresosStore',
    fields: [
        {name: 'id', type: 'string'},
        {name:  'nombre', type: 'string'}

    ] ,

    data: [
        {id:'01',nombre:'Sancion'},
        {id:'02',nombre:'Intereses'},
        {id:'03',nombre:'Alquiler'}

    ]

});


var filtersCfg_ingresos = {
    ftype: 'filters',
    local: true,
    filters: [{
        type: 'string',
        dataIndex: 'id'
    },{
        type: 'string',
        dataIndex: 'nombre'
    }]
};



Ext.define('condominio_js.admin_AvisoCobro', {
    extend: 'Ext.tab.Panel',

    height: 478,
    width: 732,
    activeTab: 0,

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [

                   {
                                    xtype: 'gridpanel',
                                    x: 10,
                                    y: 50,
                                    height: 180,
                                    width: 330,
                                    title: 'Tipo Ingresos',
                                    store: store_tipo_ingreso,
                                    features : [filtersCfg_ingresos],
                                    columns: [
                                        {
                                            xtype: 'gridcolumn',
                                            dataIndex: 'id',
                                            text: 'ID',
                                            filterable: true,
                                            name:'id'
                                        },
                                        {
                                            xtype: 'gridcolumn',
                                            width: 150,
                                            dataIndex: 'nombre',
                                            text: 'Nombre',
                                            filterable: true,
                                            name:'nombre'
                                        }
                                    ]
                                },
                                  {
                                    xtype: 'textfield',
                                    x: 10,
                                    y: 20,
                                    width: 220,
                                    fieldLabel: 'Nombre',
                                    id:'txt_nuevo_ingreso'

                                },
                                 {
                                    xtype: 'button',
                                    x: 240,
                                    y: 20,
                                    text: 'nuevo ingreso+',
                                    handler: function () {
                                        var new_data = {
                                            'ingreso': {
                                                "id": '05',
                                                "nombre": Ext.getCmp('txt_nuevo_ingreso').getValue()
                                            }
                                        };

                                        Ext.getStore('ingresosStore').add(new_data.ingreso);
                                        Ext.getCmp('txt_nuevo_ingreso').reset();

                                    }

                                }


]})
        me.callParent(arguments);
    }

});
EN

回答 1

Stack Overflow用户

发布于 2014-02-13 07:44:22

如果你删除了你正在分享的代码中没有包含的功能,它就会起作用(see fiddle)。所以我打赌你的问题来自于这个特性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21741863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档