2014-02-12 52 views
0

我有一个静态存储网格,我想添加一个记录,以显示它在网格中,但是当我尝试将其添加到商店,但网格不显示它。Extjs商店更新

我有添加FilterFeature网格列

这里的商店:

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

}); 

回答

0

它的工作原理(see fiddle)如果你删除你还没有包含在你的代码的功能分享...所以我敢打赌,你的问题来自这个功能。

+0

正确,但我需要声明的功能,因为有滤波器配置filtersCfg_ingresos @rixo –

+0

这对我来说很酷......但是没有人能够在不知道这个功能配置中有什么配置的情况下给予进一步的帮助。 – rixo

+0

请检查agin my edit..there的filtersCfg_ingresos配置@rixo –