http://jsfiddle.net/herrturtur/ExWFH/
To try this:
- click the plus button,
- double click the newly created name field,
- fill something in for the fields
- press Enter.
The era fields (from and until) get displayed properly, but aren’t saved (reload to see the effect) and the Name field isn’t updated at all.
I call this.model.save() after set()ting the attributes in NameView’s close function (triggered by Enter-keypress) in line 153.
close: function(e){
this.$el.removeClass('editing');
this.model.set({
value: this.$('.name-value').val(),
from: this.model.from, // this is saved in the
until: this.model.until
});
this.model.save();
if(this.eraView.$el.attr('editing')){
this.eraView.close();
}
this.render();
},
Could someone tell me what I’m doing wrong?
On top of everything, I get a TypeError: Illegal Invocation in Chrome.
The issue that you’re having is when calling the
closefunction.Within your
closefunction, you’re calling itself so it seems like a loop of redundancy.JS Bin
On your
karass.EraView, you’re also triggering the same function within the function which is unnecessary. I would suggest renaming it to a different function that corresponds to the intent of the action.