partkeepr

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

PartController.js (1216B)


      1 Ext.define("PartKeepr.Components.Part.PartController", {
      2     extend: 'Ext.app.ViewController',
      3 
      4     alias: 'controller.PartController',
      5 
      6     reload: function () {
      7         var view = this.getView();
      8 
      9         view.down("PartGrid").getStore().reload();
     10     },
     11     search: function (field) {
     12         var value = field.getValue();
     13         this.getView().down("#searchField").hide();
     14         this.getView().down("PartGrid").getStore().doSearch(value);
     15     },
     16     resetSearch: function () {
     17         this.getView().down("PartGrid").getStore().resetSearch();
     18         this.getView().down("#searchField").hide();
     19     },
     20     revealSearchField: function () {
     21         if (this.getView().down("#searchField").isHidden())
     22         {
     23             this.getView().down("#searchField").show();
     24             this.getView().down("#searchField").focus();
     25         } else {
     26             this.getView().down("#searchField").hide();
     27             this.getView().down("PartGrid").getStore().doSearch(
     28                 this.getView().down("#searchField").getValue()
     29             )
     30         }
     31     },
     32     showPartDetails: function (part) {
     33         Ext.Viewport.down("PartDetails").setPart(part);
     34         Ext.Viewport.down("PartDetails").show();
     35     }
     36 
     37  });