Hi,

PFA minor patch which will add basic formatting in our custom SlickGrid
JSON editor.
RM#2748

I have updated RM with sample sql for testing.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/static/js/slickgrid/editors.js 
b/web/pgadmin/static/js/slickgrid/editors.js
index ab0bff0..0b38da5 100644
--- a/web/pgadmin/static/js/slickgrid/editors.js
+++ b/web/pgadmin/static/js/slickgrid/editors.js
@@ -387,12 +387,12 @@
     this.loadValue = function (item) {
       var data = defaultValue = item[args.column.field];
       if (data && typeof data === "object" && !Array.isArray(data)) {
-        data = JSON.stringify(data);
+        data = JSON.stringify(data, null, 4);
       } else if (Array.isArray(data)) {
         var temp = [];
         $.each(data, function(i, val) {
           if (typeof val === "object") {
-            temp.push(JSON.stringify(val));
+            temp.push(JSON.stringify(val, null, 4));
           } else {
             temp.push(val)
           }
@@ -722,12 +722,12 @@
     this.loadValue = function (item) {
       var data = defaultValue = item[args.column.field];
       if (typeof data === "object" && !Array.isArray(data)) {
-        data = JSON.stringify(data);
+        data = JSON.stringify(data, null, 4);
       } else if (Array.isArray(data)) {
         var temp = [];
         $.each(data, function(i, val) {
           if (typeof val === "object") {
-            temp.push(JSON.stringify(val));
+            temp.push(JSON.stringify(val, null, 4));
           } else {
             temp.push(val)
           }

Reply via email to