diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js index 52022c1b5..04e07d417 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js @@ -183,17 +183,25 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { // Need to show this field only when creating new table // [in SubNode control] id: 'is_primary_key', label: '{{ _('Primary key?') }}', - cell: Backgrid.Extension.SwitchDepCell, type: 'switch', deps:['name'], - options: { onText: 'Yes', offText: 'No', onColor: 'success', offColor: 'primary' }, - cellHeaderClasses:'width_percent_5', + cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', + deps:['name'], cellHeaderClasses:'width_percent_5', + options: { + onText: '{{ _("Yes") }}', offText: '{{ _("No") }}', + onColor: 'success', offColor: 'primary' + }, visible: function(m) { - return _.isUndefined(m.top.node_info['table'] || m.top.node_info['view'] || m.top.node_info['mview']); + return _.isUndefined( + m.top.node_info['table'] || m.top.node_info['view'] || + m.top.node_info['mview'] + ); }, disabled: function(m){ // If primary key already exist then disable. - if (m.top && !_.isUndefined(m.top.get('oid')) && - m.top.get('primary_key').length > 0 && - !_.isUndefined(m.top.get('primary_key').first().get('oid'))) { + if ( + m.top && !_.isUndefined(m.top.get('oid')) && + m.top.get('primary_key').length > 0 && + !_.isUndefined(m.top.get('primary_key').first().get('oid')) + ) { return true; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js index 8ff835992..222d497d4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js @@ -107,7 +107,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } },{ id: 'sort_order', label:'{{ _('Sort order') }}', - cell: Backgrid.Extension.SwitchDepCell, type: 'switch', + cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', disabled: 'checkAccessMethod', editable: function(m) { // Header cell then skip @@ -124,7 +124,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } },{ id: 'nulls', label:'{{ _('NULLs') }}', - cell: Backgrid.Extension.SwitchDepCell, type: 'switch', + cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', disabled: 'checkAccessMethod', editable: function(m) { // Header cell then skip diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js index 0ea8cd6cd..76919aaba 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js @@ -456,9 +456,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }); } - // Switch Cell with Deps - var SwitchDepCell = - Backgrid.Extension.SwitchDepCell = Backgrid.Extension.SwitchCell.extend({ + // Switch Cell with Deps (specifically for table children) + var TableChildSwitchCell = + Backgrid.Extension.TableChildSwitchCell = Backgrid.Extension.SwitchCell.extend({ initialize: function() { Backgrid.Extension.SwitchCell.prototype.initialize.apply(this, arguments); Backgrid.Extension.DependentCell.prototype.initialize.apply(this, arguments);