fixes issue 1973 and 1911 (#1992)

Remove previous icon class name before adding the new class name
This commit is contained in:
Deep Tailor 2018-04-17 17:52:07 -07:00 committed by Andrew Henry
parent 19fc05b76d
commit 94c35a67c5

View File

@ -40,10 +40,18 @@ define([
return type.getCssClass();
}
function removePreviousIconClass(el) {
$(el).removeClass(function (index, className) {
return (className.match (/\bicon-\S+/g) || []).join(' ');
});
}
TreeLabelView.prototype.updateView = function (domainObject) {
var titleEl = this.el.find('.t-title-label'),
iconEl = this.el.find('.t-item-icon');
removePreviousIconClass(iconEl);
titleEl.text(domainObject ? domainObject.getModel().name : "");
iconEl.addClass(domainObject ? getClass(domainObject) : "");