public inbox for [email protected]
help / color / mirror / Atom feedbackform select2 control
2+ messages / 1 participants
[nested] [flat]
* backform select2 control
@ 2016-01-06 06:31 Harshal Dhumal <[email protected]>
2016-01-07 04:32 ` Re: backform select2 control Harshal Dhumal <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Harshal Dhumal @ 2016-01-06 06:31 UTC (permalink / raw)
To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers
Hi,
Please find patch for backform select2 and select2ajaxoptoins controls
Usage:
schema: [{
id: 'name', label: '{{ _('Name') }}', cell: 'string',
type: 'select2', select2:{tags: "true", placeholder: "Select an
option", allowClear: true}
}
.
.
.
--
*Harshal Dhumal*
*Software Engineer *
EenterpriseDB <http://www.enterprisedb.com;
--
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] select2_backform_controls_6_Jan.patch (2.7K, 3-select2_backform_controls_6_Jan.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index a251200..c9729a8 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -174,5 +174,53 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
})
});
+
+ /*
+ * Backform Select2AjaxOptions control.
+ */
+ var Select2AjaxOptionsControl = Backform.Select2AjaxOptionsControl = Backform.NodeAjaxOptionsControl.extend({
+ render: function() {
+
+ var options = this.field.get('options') || [];
+
+ /* Add empty option as Select2 requires any empty '<option><option>' for
+ * some of its functionality to work.
+ */
+ options.unshift({label: undefined, value: undefined});
+
+ Backform.NodeAjaxOptionsControl.prototype.render.apply(this, arguments);
+
+ var col = _.defaults(this.field.toJSON(), this.defaults)
+ // Initialize select2 control.
+ this.$el.find("select").select2(col.select2);
+ return this;
+ }
+ });
return Backform.NodeListControl;
});
diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css
index 6d0f662..3ec4d6f 100755
--- a/web/pgadmin/static/css/overrides.css
+++ b/web/pgadmin/static/css/overrides.css
@@ -611,3 +611,20 @@ table.backgrid tr.new {
right: 0px;
bottom :0;
}
+.select2 {
+ width: 100% !important;
+}
+.select2-search__field, select{
+ background:inherit !important;
+}
\ No newline at end of file
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 7423909..86b9416 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -74,7 +74,8 @@
'multiline': ['textarea', 'textarea', 'string'],
'collection': ['sub-node-collection', 'sub-node-collection', 'string'],
'uniqueColCollection': ['unique-col-collection', 'unique-col-collection', 'string'],
- 'switch' : 'switch'
+ 'switch' : 'switch',
+ 'select2': 'select2',
};
@@ -1174,5 +1210,25 @@
return groups;
}
+ /*
+ * Backform Select2 control.
+ */
+ var Select2Control = Backform.Select2Control = Backform.SelectControl.extend({
+ render: function() {
+ var options = this.field.get('options') || [];
+ /* Add empty option as Select2 requires any empty '<option><option>' for
+ * some of its functionality to work.
+ */
+
+ options.unshift({label: undefined, value: undefined});
+
+ Backform.SelectControl.prototype.render.apply(this, arguments);
+
+ var col = _.defaults(this.field.toJSON(), this.defaults)
+ // Initialize select2 control.
+ this.$el.find("select").select2(col.select2);
+ return this;
+ }
+ });
return Backform;
}));
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: backform select2 control
2016-01-06 06:31 backform select2 control Harshal Dhumal <[email protected]>
@ 2016-01-07 04:32 ` Harshal Dhumal <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Harshal Dhumal @ 2016-01-07 04:32 UTC (permalink / raw)
To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers
Hi,
Updated patch. As yesterdays patch for backform select2 and
select2ajaxoptoins controls was throwing malformed patch error.
--
*Harshal Dhumal*
*Software Engineer *
EenterpriseDB <http://www.enterprisedb.com;
On Wed, Jan 6, 2016 at 12:01 PM, Harshal Dhumal <
[email protected]> wrote:
> Hi,
>
> Please find patch for backform select2 and select2ajaxoptoins controls
>
> Usage:
>
> schema: [{
> id: 'name', label: '{{ _('Name') }}', cell: 'string',
> type: 'select2', select2:{tags: "true", placeholder: "Select an option", allowClear: true}
> }
> .
> .
> .
>
>
>
>
> --
> *Harshal Dhumal*
> *Software Engineer *
>
>
>
> EenterpriseDB <http://www.enterprisedb.com;
>
--
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] select2_backform_controls_7_Jan_updated.patch (2.7K, 3-select2_backform_controls_7_Jan_updated.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js
index a251200..c9729a8 100644
--- a/web/pgadmin/browser/static/js/node.ui.js
+++ b/web/pgadmin/browser/static/js/node.ui.js
@@ -174,5 +174,53 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
})
});
+
+ /*
+ * Backform Select2AjaxOptions control.
+ */
+ var Select2AjaxOptionsControl = Backform.Select2AjaxOptionsControl = Backform.NodeAjaxOptionsControl.extend({
+ render: function() {
+
+ var options = this.field.get('options') || [];
+
+ /* Add empty option as Select2 requires any empty '<option><option>' for
+ * some of its functionality to work.
+ */
+ options.unshift({label: undefined, value: undefined});
+
+ Backform.NodeAjaxOptionsControl.prototype.render.apply(this, arguments);
+
+ var col = _.defaults(this.field.toJSON(), this.defaults)
+ // Initialize select2 control.
+ this.$el.find("select").select2(col.select2);
+ return this;
+ }
+ });
return Backform.NodeListControl;
});
diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css
index 6d0f662..3ec4d6f 100755
--- a/web/pgadmin/static/css/overrides.css
+++ b/web/pgadmin/static/css/overrides.css
@@ -611,3 +611,20 @@ table.backgrid tr.new {
right: 0px;
bottom :0;
}
+.select2 {
+ width: 100% !important;
+}
+.select2-search__field, select{
+ background:inherit !important;
+}
\ No newline at end of file
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 7423909..86b9416 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -74,7 +74,8 @@
'multiline': ['textarea', 'textarea', 'string'],
'collection': ['sub-node-collection', 'sub-node-collection', 'string'],
'uniqueColCollection': ['unique-col-collection', 'unique-col-collection', 'string'],
- 'switch' : 'switch'
+ 'switch' : 'switch',
+ 'select2': 'select2',
};
@@ -1174,5 +1210,25 @@
return groups;
}
+ /*
+ * Backform Select2 control.
+ */
+ var Select2Control = Backform.Select2Control = Backform.SelectControl.extend({
+ render: function() {
+ var options = this.field.get('options') || [];
+ /* Add empty option as Select2 requires any empty '<option><option>' for
+ * some of its functionality to work.
+ */
+
+ options.unshift({label: undefined, value: undefined});
+
+ Backform.SelectControl.prototype.render.apply(this, arguments);
+
+ var col = _.defaults(this.field.toJSON(), this.defaults)
+ // Initialize select2 control.
+ this.$el.find("select").select2(col.select2);
+ return this;
+ }
+ });
return Backform;
}));
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-01-07 04:32 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 06:31 backform select2 control Harshal Dhumal <[email protected]>
2016-01-07 04:32 ` Harshal Dhumal <[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