tags:

views:

157

answers:

1

I'm testing the sproutcore todo's tutorial and I have checked the code in step-5 and it's identical to my code at least as far as I can see, but the addButton is not responding to click events.

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;

and in the main:

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

I can't see the problem, please help.

(I have only tested this in firefox on kubuntu)

+1  A: 

I have had similar problem and my solution was:

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