2009-11-24 54 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" 
    }),