{ "id": "roo-file-374", "name": "Pman.Tab.XtupleMetric", "parent": "Pman.Tab.Admin", "title": "", "path": "/home/edward/gitlive/web.xtuple/Pman/Xtuple/Pman.Tab.XtupleMetric.bjs", "items": [ { "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": "metric", "title": "Metric", "xtype": "GridPanel", "|xns": "Roo", "items": [ { "listeners": { "|render": "function() \n{\n _this.grid = this; \n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}", "afteredit": "function (e)\n{\n if(e.originalValue == e.value || !e.value.length){\n return false;\n }\n \n e.record.commit();\n}" }, "*prop": "grid", "autoExpandColumn": "metric_value", "clicksToEdit": 1, "loadMask": true, "xtype": "EditorGrid", "|xns": "Roo.grid", "items": [ { "listeners": { "beforeload": "function (_self, o){\n o.params = o.params || {};\n \n var s = _this.searchBox.getValue();\n \n if(!s || !s.length){\n return;\n }\n \n o.params['search[name]'] = s;\n}\n", "update": "function (_self, record, operation)\n{\n if (operation != Roo.data.Record.COMMIT) {\n return;\n }\n\n if (!record.data.metric_name.length || !record.data.metric_value.length) {\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Metric',\n method : 'POST',\n params : record.data,\n success : function(res) {\n _this.grid.footer.onClick('refresh');\n }\n });\n \n}" }, "*prop": "dataSource", "remoteSort": true, "xtype": "Store", "|sortInfo": "{ field : 'metric_name', direction: 'ASC' }", "|xns": "Roo.data", "items": [ { "*prop": "proxy", "method": "GET", "timeout": 90000, "xtype": "HttpProxy", "|url": "baseURL + '/Xtuple/Roo/Metric.php'", "|xns": "Roo.data" }, { "*prop": "reader", "id": "metric_id", "root": "data", "totalProperty": "total", "xtype": "JsonReader", "|fields": "[\n {\n 'name': 'metric_id',\n 'type': 'int'\n },\n {\n 'name': 'metric_name',\n 'type': 'string'\n },\n {\n 'name': 'metric_value',\n 'type': 'string'\n },\n {\n 'name': 'metric_module',\n 'type': 'string'\n }\n]", "|xns": "Roo.data" } ] }, { "|xns": "Roo", "xtype": "Toolbar", "*prop": "toolbar", "items": [ { "listeners": { "specialkey": "function (_self, e)\n{\n _this.grid.footer.onClick('first');\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');\r\n}" }, "cls": "x-btn-icon", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'", "|xns": "Roo.Toolbar" }, { "|xns": "Roo.Toolbar", "xtype": "Fill" }, { "listeners": { "|click": "function()\n{\n \n var nr = _this.grid.ds.reader.newRow({\n metric_id : 0,\n metric_name : '',\n metric_value : '',\n metric_module : ''\n });\n \n _this.grid.stopEditing();\n _this.grid.ds.insert(0, nr); \n _this.grid.startEditing(0, 0);\n}\n" }, "cls": "x-btn-text-icon", "text": "Add", "xtype": "Button", "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'", "|xns": "Roo.Toolbar" }, { "listeners": { "|click": "function ()\n{ \n var cs = _this.grid.getSelectionModel().getSelectedCell();\n \n if (!cs) {\n Roo.MessageBox.alert(\"Error\", \"Select a cell\");\n return;\n }\n _this.grid.stopEditing();\n \n var r = _this.grid.ds.getAt(cs[0]);\n \n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete this metric?\", function (v){\n if (v != 'yes') {\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/Metric',\n method : 'POST',\n params : {\n _delete : r.data.id\n },\n success : function(res) {\n _this.grid.footer.onClick('refresh');\n }\n });\n });\n}" }, "cls": "x-btn-text-icon", "text": "Remove", "xtype": "Button", "|icon": "rootURL + '/Pman/templates/images/trash.gif'", "|xns": "Roo.Toolbar" } ] }, { "*prop": "footer", "displayInfo": true, "emptyMsg": "No Metric found", "pageSize": 50, "xtype": "PagingToolbar", "|xns": "Roo" }, { "*prop": "colModel[]", "dataIndex": "metric_name", "header": "Name", "width": 250, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "allowBlank": false, "xtype": "TextField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "metric_value", "header": "Value", "width": 150, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "allowBlank": false, "xtype": "TextField", "|xns": "Roo.form" } ] } ] }, { "*prop": "colModel[]", "dataIndex": "metric_module", "header": "Module", "width": 100, "xtype": "ColumnModel", "|renderer": "function(v) { return String.format('{0}', v); }", "|xns": "Roo.grid", "items": [ { "|xns": "Roo.grid", "xtype": "GridEditor", "*prop": "editor", "items": [ { "*prop": "field", "allowBlank": false, "xtype": "TextField", "|xns": "Roo.form" } ] } ] } ] } ] } ], "permname": "", "modOrder": "900" }