From 9c424d53e03566db138092b12ec54d5ed557cafb Mon Sep 17 00:00:00 2001 From: Thomas Rueckstiess Date: Tue, 7 Jul 2015 23:15:40 +0200 Subject: [PATCH] fixed bug that didn't update the type bar widths after unfiltering fields. --- scout-ui/src/field-list/type-list-item.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scout-ui/src/field-list/type-list-item.js b/scout-ui/src/field-list/type-list-item.js index b8ddbd0f26d..b0f53c0f05c 100644 --- a/scout-ui/src/field-list/type-list-item.js +++ b/scout-ui/src/field-list/type-list-item.js @@ -8,6 +8,7 @@ var debug = require('debug')('scout-ui:field-list:type-list-item'); require('bootstrap/js/tooltip'); module.exports = AmpersandView.extend({ + template: require('./type-list-item.jade'), bindings: { 'model.name': [ { @@ -33,16 +34,16 @@ module.exports = AmpersandView.extend({ } }, initialize: function() { - this.listenTo(this.model, 'change:count', _.debounce(function() { - $(this.el).tooltip({ - title: format('%s (%s)', this.model.getId(), numeral(this.model.probability).format('%')) - }); - $(this.queryByHook('bar')).css({ - width: Math.floor(this.model.probability * 100) + '%' - }); - }.bind(this), 300)); + this.listenTo(this.model, 'change:probability', _.debounce(this.update.bind(this), 300)); + }, + update: function() { + $(this.el).tooltip({ + title: format('%s (%s)', this.model.getId(), numeral(this.model.probability).format('%')) + }); + $(this.queryByHook('bar')).css({ + width: Math.floor(this.model.probability * 100) + '%' + }); }, - template: require('./type-list-item.jade'), typeClicked: function() { var fieldList = this.parent.parent; if (!fieldList.minichartModel || (fieldList.minichartModel.modelType !== this.model.modelType)) { @@ -51,6 +52,7 @@ module.exports = AmpersandView.extend({ }, render: function() { this.renderWithTemplate(this); + this.update(); return this; } });