django-autocomplete-light
django-autocomplete-light copied to clipboard
Overriding templateResult / templateItem functions?
Hi, I wonder whether there could be a cleaner way to override templateResult and templateItem callbacks without changing the whole init callback as described here: https://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#overriding-javascript-code Thanks a lot for your work!
Perhaps we could refactor the init callback to make it easier ?
Have you been happy with your init callback override ?
Refactoring the init callback would be very useful indeed! My own override involved duplicating quite a lot of code, so no, I can't really say I am happy with my current solution.
Sounds ok for me, looking forward to review your patch proposal !
can we get a fuller example of overriding the init?
document.addEventListener('dal-init-function', function () {
yl.registerFunction( 'select2', function ($, element) {
// autocomplete function here
});
})
What do you put in the middle? something like
$('#my-select').select2({
createTag: function() { console.log('test'); }
});
?