Pman.Tab.AdminCompanies.bjs
[Pman.Admin] / Pman.Tab.AdminCompanies.bjs
index 7f9b902..e563248 100644 (file)
@@ -1,11 +1,12 @@
 {
     "id": "roo-file-1",
     "name": "Pman.Tab.AdminCompanies",
-    "parent": "",
-    "title": "",
+    "parent": "Pman.Tab.Admin",
+    "title": "Pman.Tab.AdminCompanies",
     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminCompanies.bjs",
     "items": [
         {
+            "region": "center",
             "title": "Companies",
             "xtype": "NestedLayoutPanel",
             "|xns": "Roo",
                         },
                         {
                             "*prop": "south",
+                            "height": 150,
+                            "split": true,
+                            "titlebar": true,
                             "xtype": "LayoutRegion",
                             "|xns": "Roo"
                         },
                         {
-                            "|xns": "Roo",
-                            "xtype": "GridPanel",
-                            "title": "Companies",
-                            "fitToframe": true,
-                            "fitContainer": true,
-                            "tableName": "Companies",
-                            "background": true,
-                            "region": "center",
                             "listeners": {
                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
                             },
+                            "background": true,
+                            "fitContainer": true,
+                            "fitToframe": true,
+                            "region": "center",
+                            "tableName": "Companies",
+                            "title": "Companies",
+                            "xtype": "GridPanel",
+                            "|xns": "Roo",
                             "items": [
                                 {
                                     "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                                        "|render": "function() \n{\n    _this.grid = this; \n     _this.dialog = Pman.Dialog.Companies;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n    \n}\n",
+                                        "rowclick": "function (_self, rowIndex, e)\n{\n  try { Pman.Tab.AdminOffice.grid.footer.onClick('refresh'); } catch(e) {}\n}"
                                     },
                                     "*prop": "grid",
                                     "autoExpandColumn": "name",
                                     "items": [
                                         {
                                             "listeners": {
-                                                "load": "function (_self, records, options)\n{\n   try {\n        Pman.Tab.Office.grid.footer.onClick('refresh');\n    } catch (e) {}\n}"
+                                                "load": "function (_self, records, options)\n{\n   try {\n        Pman.Tab.AdminOffice.grid.footer.onClick('refresh');\n    } catch (e) {}\n}",
+                                                "beforeload": "function (_self, o)\n{\n   o.params = o.params || {};\n   try {\n       o.params['query[name]'] = _this.searchBox.getValue();\n   } catch(e) { return false; }\n}"
                                             },
                                             "*prop": "dataSource",
                                             "remoteSort": true,
                                             "xtype": "Store",
-                                            "|sortInfo": "{ field : 'code', direction: 'ASC' }",
+                                            "|sortInfo": "{ field : 'name', direction: 'ASC' }",
                                             "|xns": "Roo.data",
                                             "items": [
                                                 {
                                             "xtype": "Toolbar",
                                             "|xns": "Roo",
                                             "items": [
+                                                {
+                                                    "listeners": {
+                                                        "show": "function (_self)\n{\n\n}",
+                                                        "specialkey": "function (_self, e)\n{\n if (e.getKey() == 13) {\n     _this.grid.footer.onClick( 'first' );\n  }\n}",
+                                                        "render": "function (_self)\n{\n_this.searchBox = _self;\n}"
+                                                    },
+                                                    "xtype": "TextField",
+                                                    "|xns": "Roo.form"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
+                                                    },
+                                                    "cls": "x-btn-icon",
+                                                    "xtype": "Button",
+                                                    "|icon": "rootURL + '/Pman/templates/images/search.gif'",
+                                                    "|xns": "Roo.Toolbar"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    _this.grid.footer.onClick('first');\n}"
+                                                    },
+                                                    "cls": "x-btn-icon",
+                                                    "xtype": "Button",
+                                                    "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                                    "|xns": "Roo.Toolbar"
+                                                },
                                                 {
                                                     "|xns": "Roo.Toolbar",
                                                     "xtype": "Fill"
                                                     "|xns": "Roo.Toolbar"
                                                 },
                                                 {
-                                                    "text": "Edit",
-                                                    "xtype": "Button",
-                                                    "cls": "x-btn-text-icon",
-                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
                                                     "listeners": {
                                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) return;\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
                                                     },
+                                                    "cls": "x-btn-text-icon",
+                                                    "text": "Edit",
+                                                    "xtype": "Button",
+                                                    "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
                                                     "|xns": "Roo.Toolbar"
                                                 },
                                                 {
                                             "*prop": "colModel[]",
                                             "dataIndex": "code",
                                             "header": "Ref#",
+                                            "sortable": true,
                                             "width": 50,
                                             "xtype": "ColumnModel",
                                             "|renderer": "function(v) { return String.format('{0}', v); }",
                                             "*prop": "colModel[]",
                                             "dataIndex": "name",
                                             "header": "Name",
+                                            "sortable": true,
                                             "width": 200,
                                             "xtype": "ColumnModel",
                                             "|renderer": "function(v,x,r) {\n    return String.format(r.data.isOwner ? '<B>{0}</B>' : '{0}',v);    \n}",
                                             "*prop": "colModel[]",
                                             "dataIndex": "email",
                                             "header": "Email",
+                                            "sortable": true,
                                             "width": 100,
                                             "xtype": "ColumnModel",
                                             "|renderer": " function (v) {\n        return (v.length && v.indexOf('@') > 0 ) ? \n            String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n            \n    }",
                                             "|xns": "Roo.grid"
                                         },
                                         {
-                                            "xtype": "ColumnModel",
+                                            "*prop": "colModel[]",
+                                            "dataIndex": "address",
                                             "header": "Address",
+                                            "sortable": true,
                                             "width": 200,
-                                            "dataIndex": "address",
+                                            "xtype": "ColumnModel",
                                             "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid",
-                                            "*prop": "colModel[]"
+                                            "|xns": "Roo.grid"
                                         },
                                         {
                                             "xtype": "ColumnModel",
         }
     ],
     "permname": "",
-    "modOrder": "001"
+    "modOrder": "030"
 }
\ No newline at end of file