2012-08-07 32 views
0

我試圖做一個互動的表對象的內容,顯示出一個彈出當用戶的鼠標在電池獲取鼠標操作

{{#each App.PuberController}} 
    {{#view App.PuberView contentBinding="App.PuberController" tagName="tr" }} 
    <td>{{#if logo}}<img {{bindAttr src="logo"}} />{{else}}No logo{{/if}}</td> 
    <td>{{title}}</td> 
    <td>{{type}}</td> 
    {{/view}} 
{{/each}} 

而且,

App.PuberController = Ember.ArrayController.create({ 
    content: [...] 
}); 


App.PuberView = Ember.View.extend({ 
    content: null, 

    mouseEnter: function(evt) { 
    //Here I want to access content of the object 
    } 
}) 

我想例如在mouseEnter函數()中具有當前對象的名稱。 1.0版預之前,我能做到這一點與

this.getPath('content.title'); 

但它不工作了......

回答

1

首先,令人奇怪的是你要綁定的App.PuberController在:

{{#view App.PuberView contentBinding="App.PuberController" tagName="tr" }} 

我會相當期待this,或者類似這樣的一個別名:

{{#each puber in App.PuberController}} 
    {{#view App.PuberView contentBinding="puber" ... 

也許你的代碼不完全是這段代碼的反映?或者,這應該現在的工作... :-)


另一句話:你現在應該使用get而不是getPath

this.get('content.title'); 
+0

謝謝!我的綁定運行良好,以顯示信息,但不是'獲取'的東西。 你更清楚,並與'得到'一起工作! – 2012-08-08 09:08:22

+0

很高興能幫到你:-) – 2012-08-08 09:09:59