From 850622c8e811b7465946165352a17f95f90897df Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 25 May 2015 14:24:45 +0200 Subject: SONAR-6565 add select list for groups --- .../src/main/js/components/common/select-list.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'server/sonar-web/src/main/js/components') diff --git a/server/sonar-web/src/main/js/components/common/select-list.js b/server/sonar-web/src/main/js/components/common/select-list.js index d2ca6af8b27..480fbd9d690 100644 --- a/server/sonar-web/src/main/js/components/common/select-list.js +++ b/server/sonar-web/src/main/js/components/common/select-list.js @@ -28,9 +28,12 @@ define(function () { var SelectListCollection = Backbone.Collection.extend({ + initialize: function (options) { + this.options = options; + }, + parse: function (r) { - this.more = r.more; - return r.results; + return this.options.parse.call(this, r); }, fetch: function (options) { @@ -377,7 +380,9 @@ define(function () { window.SelectList = function (options) { this.settings = $.extend(window.SelectList.defaults, options); - this.collection = new SelectListCollection(); + this.collection = new SelectListCollection({ + parse: this.settings.parse + }); this.view = new SelectListView({ el: this.settings.el, @@ -421,6 +426,11 @@ define(function () { return item.value; }, + parse: function (r) { + this.more = r.more; + return r.results; + }, + labels: { selected: 'Selected', deselected: 'Deselected', -- cgit v1.2.3