2017-07-04 7 views
0

在我的handSon表中,我想僅在一行中顯示文本,之後應該有...,如果有更多文本。僅在一行中顯示文本後面...在handson表動態列中

$scope.textRenderer = function (instance, td, row, col, prop, value, cellProperties) { 
 
      if (cellProperties) { 
 
       
 
       var template; 
 
       template = ['<span style="white-space:nowrap; overflow:hidden;text-overflow: ellipsis;">' + value + '</span>'].join(''); 
 
       while (td.firstChild) { 
 
        td.removeChild(td.firstChild); 
 
       } 
 

 
       if (!td.firstChild) { 
 
        td.appendChild($compile(template)($scope)[0]); 
 
       } 
 
      } 
 
      return td; 
 
     };

我已經嘗試了上述代碼但省略號未示出。

回答

2

您要做的事不適用於inline元素。

給你的span標籤display:block;

+0

謝謝,它的工作原理 – user6649141

相關問題