Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleMetric.bjs
index 096b1c8..733f542 100644 (file)
                                 },
                                 {
                                     "listeners": {
-                                        "|click": "function()\n{\n\n   Pman.Dialog.XtupleSalesOrderNew.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
+                                        "|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"
                                 }
                             ]
                         },