2013-07-02 31 views
0

這是我的咖啡,我根本看不出爲什麼這是錯誤的。我不斷收到意想不到的錯誤。咖啡腳本編譯錯誤

renderTable:()=> 
    @table = d3.select("#search-results-area").append("table").attr("id",@tableId).attr("class","visualization-panel") 
    @thead = @table.append("thead") 
    @tbody = @table.append("tbody") 
    @input = @table.append("input").attr("id",@inputId).on("keydown",(d)=> 
     console.log("keydown") 
     console.log 
     toFilter = $(@input[0][0]).val() 
     window.setTimeout(()=> 
      toFilter = $(@input[0][0]).val() 
      @tbody.selectAll("tr") 
     ,500) 
    ) 

當我拿出@tbody.selectAll("tr"),這工作,這是什麼讓我感到困惑。

我該如何解決這個問題?

回答

3

我相信它與您定義window.setTimeout部分的方式有關。 ,500)段最後由於縮進和括號而導致編譯錯誤。試着改變該條:

window.setTimeout (-> 
    toFilter = $(@input[0][0]).val() 
    @tbody.selectAll("tr") 
), 500 

保持縮進到同一地點window閉幕括號。這應該修復編譯。