瀏覽代碼

HUE-9101 [frontend] Allow observables in the ko.ellipsis binding

Johan Ahlen 6 年之前
父節點
當前提交
0f35eee78b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.ellipsis.js

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.ellipsis.js

@@ -22,7 +22,7 @@ ko.bindingHandlers.ellipsis = {
     const value = ko.unwrap(valueAccessor());
     const $element = $(element);
     const chopLength = value.length ? value.length : 30;
-    const text = typeof value === 'object' ? value.data : value;
+    const text = typeof value === 'object' ? ko.unwrap(value.data) : value;
     if (text.length > chopLength) {
       $element.attr('title', text);
       $element.text(text.substr(0, chopLength) + '...');