Pman.Tab.XtupleMetric.bjs
authorEdward <edward@roojs.com>
Tue, 5 Aug 2014 07:02:08 +0000 (15:02 +0800)
committerEdward <edward@roojs.com>
Tue, 5 Aug 2014 07:02:08 +0000 (15:02 +0800)
Pman.Tab.XtupleMetric.js

Pman.Tab.XtupleMetric.bjs
Pman.Tab.XtupleMetric.js

index a9c816d..b3d57d1 100644 (file)
                                 },
                                 {
                                     "listeners": {
-                                        "|click": "function ()\n{\n\n     var sel  = _this.invgrid.getSelectionModel().getSelected();\n    if (!sel) {\n        Roo.MessageBox.alert(\"Error\", \"Select a invoice\");\n        return;\n    }\n    // check current status of shipment..\n    \n    var params =  {\n//        cobmisc_id : sel.data.cobmisc_id,\n        _void : 1\n    };\n    if (sel.data.cobmisc_id * 1) {\n        params.cobmisc_id = sel.data.cobmisc_id * 1 ;\n    }\n    if (sel.data.cobmisc_invchead_id_invchead_id * 1) {    \n        params.invchead_id  =  sel.data.cobmisc_invchead_id_invchead_id * 1;\n    }\n    \n    Roo.MessageBox.confirm(\"Are you sure\", \"Are you sure you want to VOID that invoice?\",\n        function(r) {\n            if (r != 'yes') {\n                return;\n            }\n            new Pman.Request({\n                mask : 'Sending',\n                url : baseURL + '/Roo/cobmisc',\n                method : 'POST',\n                params :  params,\n                success : function() {\n                    _this.invgrid.ds.load({});\n                }\n            })\n            \n        }\n    );\n            \n            \n   \n}"
+                                        "|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/Core_oauth_clients',\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",
index 89b9ebc..fa9e36d 100644 (file)
@@ -200,46 +200,33 @@ Pman.Tab.XtupleMetric = new Roo.XComponent({
                             xns: Roo.Toolbar,
                             listeners : {
                                 click : function ()
-                                {
-                                
-                                     var sel  = _this.invgrid.getSelectionModel().getSelected();
-                                    if (!sel) {
-                                        Roo.MessageBox.alert("Error", "Select a invoice");
-                                        return;
-                                    }
-                                    // check current status of shipment..
+                                {   
+                                    var cs = _this.grid.getSelectionModel().getSelectedCell();
                                     
-                                    var params =  {
-                                //        cobmisc_id : sel.data.cobmisc_id,
-                                        _void : 1
-                                    };
-                                    if (sel.data.cobmisc_id * 1) {
-                                        params.cobmisc_id = sel.data.cobmisc_id * 1 ;
-                                    }
-                                    if (sel.data.cobmisc_invchead_id_invchead_id * 1) {    
-                                        params.invchead_id  =  sel.data.cobmisc_invchead_id_invchead_id * 1;
+                                    if (!cs) {
+                                        Roo.MessageBox.alert("Error", "Select a cell");
+                                        return;
                                     }
+                                    _this.grid.stopEditing();
+                                 
+                                    var r = _this.grid.ds.getAt(cs[0]);
                                     
-                                    Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
-                                        function(r) {
-                                            if (r != 'yes') {
-                                                return;
-                                            }
-                                            new Pman.Request({
-                                                mask : 'Sending',
-                                                url : baseURL + '/Roo/cobmisc',
-                                                method : 'POST',
-                                                params :  params,
-                                                success : function() {
-                                                    _this.invgrid.ds.load({});
-                                                }
-                                            })
-                                            
+                                    Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete this metric?", function (v){
+                                        if (v != 'yes') {
+                                            return;
                                         }
-                                    );
-                                            
-                                            
-                                   
+                                        
+                                        new Pman.Request({
+                                            url : baseURL + '/Roo/Core_oauth_clients',
+                                            method : 'POST',
+                                            params : {
+                                                _delete : r.data.id
+                                            },
+                                            success : function(res) {
+                                                _this.grid.footer.onClick('refresh');
+                                            }
+                                        });
+                                    });
                                 }
                             },
                             cls : 'x-btn-text-icon',