partkeepr

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

PagingToolbar.js (2332B)


      1 Ext.define("PartKeepr.PagingToolbar", {
      2     extend: "Ext.toolbar.Paging",
      3 
      4     grid: null,
      5 
      6     getPagingItems: function ()
      7     {
      8         var items = this.callParent(arguments);
      9 
     10         items.push({ xtype: 'tbseparator' });
     11 
     12         items.push(Ext.create("PartKeepr.Exporter.GridExporterButton", {
     13             itemId: 'export',
     14             tooltip: i18n("Export"),
     15             iconCls: "fugue-icon application-export",
     16             overflowText: i18n("Export"),
     17             disabled: this.store.isLoading()
     18         }));
     19 
     20         items.push(Ext.create("PartKeepr.Importer.GridImporterButton", {
     21             itemId: 'import',
     22             tooltip: i18n("Import"),
     23             overflowText: i18n("Import"),
     24             iconCls: "fugue-icon database-import",
     25             disabled: this.store.isLoading()
     26         }));
     27 
     28         items.push({ xtype: 'tbseparator' });
     29 
     30         items.push({
     31             itemId: 'addFilter',
     32             xtype: 'button',
     33             tooltip: i18n("Add Filter"),
     34             overflowText: i18n("Add Filter"),
     35             iconCls: "fugue-icon funnel--plus",
     36             disabled: this.store.isLoading(),
     37             handler: this.onAddFilterClick,
     38             scope: this
     39         });
     40 
     41         items.push(Ext.create({
     42             itemId: 'resetFilter',
     43             xtype: 'button',
     44             iconCls: 'fugue-icon funnel--minus',
     45             tooltip: i18n("Reset Filter"),
     46             hidden: true, handler: function ()
     47             {
     48                 this.store.getFilters().removeAll();
     49                 this.store.currentPage = 1;
     50                 this.store.load({start: 0});
     51 
     52             },
     53             scope: this
     54         }));
     55 
     56         items.push({ xtype: 'tbseparator' });
     57 
     58         items.push(Ext.create("PartKeepr.Components.Grid.GridPresetButton", {
     59             grid: this.grid
     60         }));
     61 
     62         return items;
     63     },
     64     onAddFilterClick: function ()
     65     {
     66         this.addFilterWindow = Ext.create("PartKeepr.Widgets.FilterExpressionWindow", {
     67 
     68             sourceModel: this.getStore().getModel(),
     69             listeners: {
     70                 "applyfilter": this.onAddFilter,
     71                 scope: this
     72             }
     73         });
     74         this.addFilterWindow.show();
     75     },
     76     onAddFilter: function (filter)
     77     {
     78         this.getStore().addFilter(filter);
     79         this.addFilterWindow.close();
     80     }
     81 });