【发布时间】:2012-02-23 07:31:12
【问题描述】:
我有一个包含两个 div 类的页面,这很好。一个是集合,另一个是项目。
但是当我想选择编辑时,我需要删除项目视图并将其替换为编辑链接,这不会发生并且它会留在那里,下面是我的编辑类会很棒。
Supernote.Views.Notes ||= {}
class Supernote.Views.Notes.EditView extends Backbone.View
template : JST["backbone/templates/notes/edit"]
events :
"submit #edit-note" : "update"
update : (e) ->
e.preventDefault()
e.stopPropagation()
@model.save(null,
success : (note) =>
@model = note
window.location.hash = "/#{@model.id}"
)
render : ->
$(@el).html(@template(@model.toJSON() ))
this.$("form").backboneLink(@model)
return this
【问题讨论】:
标签: javascript backbone.js coffeescript