partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

AppliedFiltersToolbar.js (1334B)


      1 Ext.define("PartKeepr.Grid.AppliedFiltersToolbar", {
      2     extend: "Ext.grid.Panel",
      3     store: {
      4         fields: ['name', 'filter']
      5     },
      6     hideHeaders: true,
      7     targetStore: null,
      8 
      9     initComponent: function ()
     10     {
     11         this.columns = [
     12             {
     13                 dataIndex: "name",
     14                 flex: 1
     15             }, {
     16                 xtype: 'actioncolumn',
     17                 width: 25,
     18                 items: [
     19                     {
     20                         iconCls: 'fugue-icon funnel--minus',
     21                         tooltip: i18n("Remove filter"),
     22                         handler: function (grid, rowIndex, colIndex, item, e, record)
     23                         {
     24                             this.targetStore.getFilters().remove(record.get("filter"));
     25                             this.updateFilters(this.targetStore.getFilters());
     26 
     27                         },
     28                         scope: this
     29                     }
     30                 ]
     31             }
     32         ];
     33 
     34         this.callParent(arguments);
     35 
     36     },
     37     updateFilters: function (filters)
     38     {
     39         var i;
     40 
     41         this.store.removeAll();
     42 
     43         for (i = 0; i < filters.getCount(); i++) {
     44             this.store.add({
     45                 name: filters.getAt(i).getFilterDescription(),
     46                 filter: filters.getAt(i)
     47             });
     48         }
     49 
     50     }
     51 });