2009-11-24 19 views
1

我正在測試sproutcore todo的教程,我已經檢查了第5步中的代碼,至少就我看到的而言,它與我的代碼相同,但addButton是沒有響應點擊事件。sproutcore - todos教程,addbutton在Firefox中沒有響應

addTask: function() { 
    var task; 

    task = Sinatra.store.createRecord(Sinatra.Task, {  
     'description': 'New Task', 
     'isDone': false, 
     'priority': 1 
    }); 

    this.selectObject(task); 

    this.invokeLater(function() {  
     var contentIndex = this.indexOf(task); 
     var list = Sinatra.mainPage.getPath('mainPane.middleView.contentView') 
     var listItem = list.itemViewForContentIndex(contentIndex); 
     listItem.beginEditing(); 
    }); 

    return YES; 

,並在主:

addButton: SC.ButtonView.design({   
      layout: { centerY: 0, height: 24, right: 12, width: 100 }, 
      title: 'Add Task', 
      target: 'Sinatra.tasksController', 
      action: 'addTask' 
     }), 

我看不到的問題,請大家幫忙。

(我只測試了在Firefox上的Kubuntu)

+0

是否有任何錯誤,在Firebug控制檯顯示?這通常是第一個去的地方,如果JavaScript中的某些內容沒有明顯的原因失敗。 – 2009-12-04 23:28:26

回答

1

我有類似的問題,我的解決辦法是:

addButton: SC.ButtonView.design({   
     layout: { centerY: 0, height: 24, right: 12, width: 100 }, 
     title: 'Add Task', 
     target: "Sinatra.tasksController", 
     action: "addTask" 
    }),