Hi, Here is updated patch
-- *Harshal Dhumal* *Software Engineer * EenterpriseDB <http://www.enterprisedb.com> On Fri, Mar 18, 2016 at 9:37 PM, Dave Page <dp...@pgadmin.org> wrote: > > > On Fri, Mar 18, 2016 at 11:41 AM, Harshal Dhumal < > harshal.dhu...@enterprisedb.com> wrote: > >> Hi Dave, >> >> The error is at line 84 in primary_key.js (from screenshot). >> >> In primary_key.js it requires MultiSelectAjaxControl. I guess patch of >> MultiSelectControl was not applied correctly. >> >> Can you please try again. >> >> When testing it check if (in browser script tab) MultiSelectControl is >> there in node.ui.js at line no 562 (approx). >> > > OK, I got it in the end. Took a lot of repeated cache clear outs though :-( > > So... I see two issues: > > 1) The control has a black border when it has focus, unlike other controls > that have gray ones. > Fixed. > > 2) The sizing is different from other controls, whether in large screen or > small screen modes. Please see the attached screenshots. The control should > be positioned and sized just like a text control (with the exception that > it expands to multiple rows if needed, as it does). > > Fixed. > Thanks. > > [image: Inline image 2][image: Inline image 1] > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js index a373972..21a73c0 100644 --- a/web/pgadmin/browser/static/js/node.ui.js +++ b/web/pgadmin/browser/static/js/node.ui.js @@ -556,6 +556,46 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { }) }); + /* + * Control to select multiple columns. + */ + var MultiSelectAjaxControl = Backform.MultiSelectAjaxControl = NodeAjaxOptionsControl.extend({ + formatter: { + fromRaw: function (rawData, model) { + return _.isObject(rawData) ? rawData : JSON.parse(rawData); + }, + toRaw: function (formattedData, model) { + return formattedData; + } + }, + template: _.template([ + '<label class="control-label col-sm-4"><%=label%></label>', + '<div class="pgadmin-controls col-sm-8">', + ' <select multiple="multiple" style="width:100%;" class="pgadmin-controls <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-JSON.stringify(value)%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%>>', + ' <% for (var i=0; i < options.length; i++) { %>', + ' <% var option = options[i]; %>', + ' <option value=<%-option.value%> <%=value != null && _.indexOf(value, option.value) != -1 ? "selected" : ""%> <%=option.disabled ? "disabled=\'disabled\'" : ""%>><%-option.label%></option>', + ' <% } %>', + ' </select>', + '</div>' + ].join("\n")), + getValueFromDOM: function() { + var res = []; + + this.$el.find("select").find(':selected').each(function() { + res.push($(this).attr('value')); + }); + + return res; + }, + defaults: _.extend({}, NodeAjaxOptionsControl.prototype.defaults, { + select2: { + multiple: true, + allowClear: true, + width: 'style' + } + }) + }); return Backform; }); diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css index 4dcff33..b406e43 100755 --- a/web/pgadmin/static/css/overrides.css +++ b/web/pgadmin/static/css/overrides.css @@ -807,4 +807,10 @@ td.edit-cell.editable.sortable.renderable.editor { .backgrid .textarea-cell.editor textarea { width: 100%; height: auto; +} + +.select2-container--default.select2-container--focus +.select2-selection--multiple { + border: 1px solid #aaa !important; + outline: 0 none; } \ No newline at end of file
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers