public inbox for [email protected]  
help / color / mirror / Atom feed
patch for RM1497
2+ messages / 2 participants
[nested] [flat]

* patch for RM1497
@ 2016-07-25 11:17  Harshal Dhumal <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Harshal Dhumal @ 2016-07-25 11:17 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

PFA attached for rm1497

Issue: fixed js error while re-rendering shubnode grid

-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] RM1497.patch (3.8K, 3-RM1497.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js
index b404d46..6bd6195 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js
@@ -371,6 +371,11 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
               titleTmpl({label: data.label})
             );
 
+      // Clean up existing grid if any (in case of re-render)
+      if (self.grid) {
+        self.grid.remove();
+      }
+
       $gridBody.append(self.generateHeader(data));
 
       var gridSchema = _.clone(this.gridSchema);
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index 565c266..1413dbc 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -380,6 +380,11 @@
               titleTmpl(data)
             );
 
+      // Clean up existing grid if any (in case of re-render)
+      if (self.grid) {
+        self.grid.remove();
+      }
+
       var gridSchema = _.clone(this.gridSchema);
 
       _.each(gridSchema.columns, function(col) {
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 985ed46..eadea8a 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -967,7 +967,8 @@
       return this;
     },
     showGridControl: function(data) {
-      var gridHeader = _.template([
+      var self = this,
+          gridHeader = _.template([
           '<div class="subnode-header">',
           '  <label class="control-label pg-el-sm-10"><%-label%></label>',
           '  <button class="btn-sm btn-default add" <%=canAdd ? "" : "disabled=\'disabled\'"%>><%-add_label%></buttton>',
@@ -976,6 +977,11 @@
             gridHeader(data)
             );
 
+      // Clean up existing grid if any (in case of re-render)
+      if (self.grid) {
+        self.grid.remove();
+      }
+
       if (!(data.subnode)) {
         return '';
       }
@@ -983,8 +989,7 @@
       var subnode = data.subnode.schema ? data.subnode : data.subnode.prototype,
           gridSchema = Backform.generateGridColumnsFromModel(
             data.node_info, subnode, this.field.get('mode'), data.columns
-            ),
-          self = this;
+            );
 
       // Set visibility of Add button
       if (data.mode == 'properties') {
@@ -1201,7 +1206,8 @@
       return this;
     },
     showGridControl: function(data) {
-      var gridHeader = ["<div class='subnode-header'>",
+      var self = this,
+          gridHeader = ["<div class='subnode-header'>",
           "  <label class='control-label pg-el-sm-10'>" + data.label + "</label>" ,
           "  <button class='btn-sm btn-default add'>Add</buttton>",
           "</div>"].join("\n");
@@ -1210,9 +1216,14 @@
       var subnode = data.subnode.schema ? data.subnode : data.subnode.prototype,
           gridSchema = Backform.generateGridColumnsFromModel(
             data.node_info, subnode, this.field.get('mode'), data.columns, data.schema_node
-            ), self = this,
+            ),
           pgBrowser = window.pgAdmin.Browser;
 
+      // Clean up existing grid if any (in case of re-render)
+      if (self.grid) {
+        self.grid.remove();
+      }
+
       // Set visibility of Add button
       if (data.disabled || data.canAdd == false) {
         $(gridBody).find("button.add").remove();


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: patch for RM1497
@ 2016-07-25 13:31  Dave Page <[email protected]>
  parent: Harshal Dhumal <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-07-25 13:31 UTC (permalink / raw)
  To: Harshal Dhumal <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Mon, Jul 25, 2016 at 12:17 PM, Harshal Dhumal
<[email protected]> wrote:
> Hi,
>
> PFA attached for rm1497
>
> Issue: fixed js error while re-rendering shubnode grid
>
> --
> Harshal Dhumal
> Software Engineer
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-07-25 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 11:17 patch for RM1497 Harshal Dhumal <[email protected]>
2016-07-25 13:31 ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox