Last active
August 29, 2015 14:03
-
-
Save Hubbitus/e2f5ac46cfb99162ef0d to your computer and use it in GitHub Desktop.
Found solution for my own question: http://stackoverflow.com/questions/24605350/jsrender-jsviews-bind-handlers/24618765#24618765
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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