From 94c35a67c5d39b0353771ee9eb84264c676e3bb1 Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Tue, 17 Apr 2018 17:52:07 -0700 Subject: [PATCH] fixes issue 1973 and 1911 (#1992) Remove previous icon class name before adding the new class name --- platform/commonUI/general/src/ui/TreeLabelView.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/commonUI/general/src/ui/TreeLabelView.js b/platform/commonUI/general/src/ui/TreeLabelView.js index a048662eb7..7566c065a9 100644 --- a/platform/commonUI/general/src/ui/TreeLabelView.js +++ b/platform/commonUI/general/src/ui/TreeLabelView.js @@ -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) : "");