Skip to content

Commit 61755b7

Browse files
rueckstiesskangas
authored andcommitted
debounced function that triggered type bar width changes for each document.
1 parent 3482cd4 commit 61755b7

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

scout-ui/src/field-list/type-list-item.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var $ = require('jquery');
33
var format = require('util').format;
44
var _ = require('underscore');
55
var numeral = require('numeral');
6+
var debug = require('debug')('scout-ui:field-list:type-list-item');
67

78
require('bootstrap/js/tooltip');
89

@@ -19,16 +20,6 @@ module.exports = AmpersandView.extend({
1920
}
2021
}
2122
],
22-
'model.probability': [
23-
{
24-
hook: 'bar',
25-
type: function(el) {
26-
$(el).css({
27-
width: Math.floor(this.model.probability * 100) + '%'
28-
});
29-
}
30-
}
31-
]
3223
},
3324
events: {
3425
'click .schema-field-wrapper': 'typeClicked'
@@ -46,6 +37,9 @@ module.exports = AmpersandView.extend({
4637
$(this.el).tooltip({
4738
title: format('%s (%s)', this.model.getId(), numeral(this.model.probability).format('%'))
4839
});
40+
$(this.queryByHook('bar')).css({
41+
width: Math.floor(this.model.probability * 100) + '%'
42+
});
4943
}.bind(this), 300));
5044
},
5145
template: require('./type-list-item.jade'),
@@ -54,6 +48,9 @@ module.exports = AmpersandView.extend({
5448
if (!fieldList.minichartModel || (fieldList.minichartModel.modelType !== this.model.modelType)) {
5549
fieldList.switchView(this.model);
5650
}
51+
},
52+
render: function() {
53+
this.renderWithTemplate(this);
54+
return this;
5755
}
58-
5956
});

scout-ui/src/minicharts/viz.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ module.exports = AmpersandView.extend({
133133
return this;
134134
}
135135
// redraw: function() {
136-
// debug('redraw', this.cid);
137136
// this._chooseDataSource();
138137
// this.data = this.transform(this.data);
139138
//

0 commit comments

Comments
 (0)