From ba4dc487d12f724ef891f15985f65bb18a7a9b48 Mon Sep 17 00:00:00 2001 From: benny Date: Thu, 12 Jul 2018 15:56:26 +0800 Subject: [PATCH] Pman.Dialog.AdminEnumImages.bjs Pman.Dialog.AdminEnumImages.js --- Pman.Dialog.AdminEnumImages.bjs | 12 ++++++------ Pman.Dialog.AdminEnumImages.js | 10 +++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Pman.Dialog.AdminEnumImages.bjs b/Pman.Dialog.AdminEnumImages.bjs index 081dd54..7d71128 100644 --- a/Pman.Dialog.AdminEnumImages.bjs +++ b/Pman.Dialog.AdminEnumImages.bjs @@ -24,8 +24,8 @@ "show" : "function (_self)\n{\n _this.grid.footer.onClick('first');\n}" }, "modal" : true, - "xtype" : "LayoutDialog", "title" : "Add / Edit Images", + "xtype" : "LayoutDialog", "width" : 900, "$ xns" : "Roo", "height" : 500, @@ -39,9 +39,9 @@ "listeners" : { "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, + "region" : "center", "fitToframe" : true, "background" : false, - "region" : "center", "title" : "Images", "xtype" : "GridPanel", "fitContainer" : true, @@ -81,8 +81,8 @@ }, { "$ url" : "baseURL + '/Roo/Images.php'", - "xtype" : "HttpProxy", "method" : "GET", + "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" } @@ -124,7 +124,7 @@ }, { "listeners" : { - "|click" : "function()\n{\n var ids = [];\n _this.grid.dataSource.each(function(rr) {\n console.log(_this.grid.dataSource);\n if (rr.selected) {\n \n ids.push(rr.data.id);\n }\n }); \n if (!ids.length) {\n Roo.MessageBox.alert(\"Error\", \"Select rows by clicking the row\");\n return;\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere\", \n function(res) {\n if(res != 'yes') {\n return;\n }\n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/Core_enum',\n params : {\n _delete : ids.join(',')\n },\n success : function() {\n _this.grid.footer.onClick('refresh');\n }\n });\n }\n );\n}\n " + "|click" : "function()\n{\n var ids = [];\n \n _\n \n if (!ids.length) {\n Roo.MessageBox.alert(\"Error\", \"Select rows by clicking the row\");\n return;\n }\n \n Roo.MessageBox.confirm(\n \"Confirm\", \n \"Confirm Deletion of selected rows (some rows can not be deleted if they are referenced elsewhere\", \n function(res) {\n if(res != 'yes') {\n return;\n }\n new Pman.Request({\n method : 'POST',\n url : baseURL + '/Roo/Core_enum',\n params : {\n _delete : ids.join(',')\n },\n success : function() {\n _this.grid.footer.onClick('refresh');\n }\n });\n }\n );\n}\n " }, "text" : "Delete", "xtype" : "Button", @@ -146,8 +146,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "Image", + "width" : 100, "$ renderer" : "function(v,x,r) { return String.format('', baseURL, v, r.data.filename); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -155,8 +155,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "Title", + "width" : 100, "$ renderer" : "function(v,x,r) {\n// var surl = r.json.url.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // var svurl = r.json.url_view.replace(/\\/release.php\\/Images\\//, '/i/').replace(/\\/([0-9]+)\\/.*$/, '/$1');;\n // return String.format(\n // 'Download Url : http://{0}{1}' + \n // '
View Url : http://{0}{2}' + \n //'
{3}
{4}', \n // window.location.host, surl, svurl,\n // v, r.json.descript); \n \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", diff --git a/Pman.Dialog.AdminEnumImages.js b/Pman.Dialog.AdminEnumImages.js index 095cd4f..253aa7b 100644 --- a/Pman.Dialog.AdminEnumImages.js +++ b/Pman.Dialog.AdminEnumImages.js @@ -192,13 +192,9 @@ Pman.Dialog.AdminEnumImages = { click : function() { var ids = []; - _this.grid.dataSource.each(function(rr) { - console.log(_this.grid.dataSource); - if (rr.selected) { - - ids.push(rr.data.id); - } - }); + + _ + if (!ids.length) { Roo.MessageBox.alert("Error", "Select rows by clicking the row"); return; -- 2.39.2