Skip to content

Instantly share code, notes, and snippets.

@Hubbitus
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hubbitus/e2f5ac46cfb99162ef0d to your computer and use it in GitHub Desktop.
Save Hubbitus/e2f5ac46cfb99162ef0d to your computer and use it in GitHub Desktop.
var template = $.templates({
specialistsTmpl: tmpl
});
$.templates.specialistsTmpl.link(container, {
specialists: list
}, {
onAfterCreate: function(view){
if (view.data instanceof Specialist){
console.log('onAfterCreate', view, view.data, view.tmpl.tmplName, view.data instanceof Specialist);
$(view.nodes()).find('.edit').click(
$.proxy(function(){
this.renderSaveForm($($.grep($(view.nodes()), function(it){ return 'DIV' == it.nodeName })[0])); // filter out #text nodes, one is template div
}, view.data)
);
$(view.nodes()).find('.remove').click(
$.proxy(function(){
this.removeSpecialistFromList(it.id)
}, view.data)
);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment