From ca9f82e12cbed91873d82142efbf491fc8337405 Mon Sep 17 00:00:00 2001 From: Edward Date: Tue, 25 Feb 2014 17:29:55 +0800 Subject: [PATCH] Pman.Tab.AdminTranslations.bjs Pman.Tab.AdminTranslations.js --- Pman.Tab.AdminTranslations.bjs | 2 +- Pman.Tab.AdminTranslations.js | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Pman.Tab.AdminTranslations.bjs b/Pman.Tab.AdminTranslations.bjs index c375428..2a1399e 100644 --- a/Pman.Tab.AdminTranslations.bjs +++ b/Pman.Tab.AdminTranslations.bjs @@ -228,7 +228,7 @@ "|render": "function() \n{\n _this.langgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.langpanel.active) {\n this.ds.load({});\n }\n}", "afteredit": "function (e)\n{\n var saveRec = function(rec)\n {\n var g = _this.grid;\n\n //g.getView().el.mask('Saving');\n Ext.Ajax.request({\n url : baseURL + '/Roo/I18n.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n lval : rec.get('lval')\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n },\n failure : function()\n {\n Ext.Msg.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n };\n \n saveRec.defer(1000, _this, [ e.record ]);\n}", "beforeedit": "function(e) {\n console.log('beforeedit');\n //if (e.record.get('origtxt').indexOf('<') > -1) {\n // console.log(\"HTML EDITOR!!\");\n \n // return false;\n //}\n if (e.record.get('lval').replace(/\\s+/, '').length) {\n return true;\n }\n \n \n var tl = _this.langgridCombo.getValue();\n \n tl = (tl == 'zh_HK') ? 'zh-TW' : tl; \n tl = tl.replace('_', '-');\n var rec = e.record;\n \n \n \n Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) { \n if (typeof(result) == 'object') { //error\n return; \n }\n \n if (_this.grid.activeEditor) {\n _this.grid.activeEditor.setValue(result);\n } else {\n rec.set('lval',result);\n //_this.saveRec(rec);\n }\n\n //\n \n \n //console.log(result.translation);\n });\n \n \n \n return true;\n } ", - "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){\n return;\n }\n \n var s = _this.langgrid.ds.getAt(rowIndex);\n \n if(!s || s.data.id * 1 < 0){\n return;\n }\n \n s.data.is_active = s.data.is_active ? 0 : 1;\n \n s.data.commit();\n \n \n}" + "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n if(_this.langgrid.colModel.getDataIndex(columnIndex) !== 'is_active'){\n return;\n }\n \n var s = _this.langgrid.ds.getAt(rowIndex);\n \n if(!s || s.data.id * 1 < 0){\n return;\n }\n \n new Pman.Request({\n url : baseURL+'/Roo/I18n',\n method : 'POST',\n params : {\n id : s.data.id,\n is_active : s.data.is_active ? 0 : 1\n },\n success: function(res)\n {\n _this.langgrid.ds.load({});\n \n }\n }); \n \n}" }, "*prop": "grid", "autoExpandColumn": "lval", diff --git a/Pman.Tab.AdminTranslations.js b/Pman.Tab.AdminTranslations.js index f066809..e76bf09 100644 --- a/Pman.Tab.AdminTranslations.js +++ b/Pman.Tab.AdminTranslations.js @@ -457,10 +457,19 @@ Pman.Tab.AdminTranslations = new Roo.XComponent({ return; } - s.data.is_active = s.data.is_active ? 0 : 1; - - s.data.commit(); - + new Pman.Request({ + url : baseURL+'/Roo/I18n', + method : 'POST', + params : { + id : s.data.id, + is_active : s.data.is_active ? 0 : 1 + }, + success: function(res) + { + _this.langgrid.ds.load({}); + + } + }); } }, -- 2.39.2