2015-02-06 171 views
0

我正在使用fancyTree v2.7.0的過濾器擴展名。我已經啓用了自動滾動功能來滾動到活動節點。Fancytree scrollIntoView過濾時

我遇到的問題是當樹視圖被過濾。如果您單擊展開按鈕以顯示項目的子項,則控制檯中會顯示以下錯誤消息。

Error: Fancytree assertion failed: scrollIntoView node is invisible 

我創建了一個的jsfiddle重建問題http://jsfiddle.net/ajw89/86308as6/8/

這是一個Fancytree錯誤還是我做錯了什麼?

+0

我建議你在項目頁面上爲它打開一個問題 – mar10 2015-02-06 13:09:18

+0

我已經打開了一個問題。 https://github.com/mar10/fancytree/issues/391 – 2015-02-06 14:47:22

回答

1

我遇到過同樣的問題。它只出現在autoScroll:truefilter:{mode:「hide」}設置已設置。如果您可以在沒有這些設置的情況下離開,它可以正常工作

當計算節點的最後一個子節點的自動滾動時,NodeSetExpanded()方法出現問題。如果此子項與篩選條件不匹配,則它將被篩選隱藏,因此.is(「:visible」)斷言失敗。 我已經在FancytreeNode引入下面的方法在本地固定此:

getLastVisibleChild: function() { 
     var last = null; 

     if (this.children) { 
      for(var i=0, l=this.children.length; i<l; i++){ 
       if ($(this.children[i].span).is(":visible")) { 
        last = this.children[i]; 
       } 
      } 
     } 

     return last; 
    } 

比我在nodeSetExpanded使用此方法()與

// Scroll down to last child, but keep current node visible 
node.getLastVisibleChild().scrollIntoView(true, {topNode: node}).always(function(){ 

工作正常替換

// Scroll down to last child, but keep current node visible 
node.getVisibleChild().scrollIntoView(true, {topNode: node}).always(function(){