theatlantic/django-select2-forms

how to show "add button" if no results found?

zachross25 opened this issue · 4 comments

subject

i found in source params and set to js_options
'formatNoMatches': 'function () { return "ss"; }'
in console i see error Uncaught Error: formatNoMatches must be a function or a falsy value
which format of formatNoMatches value must be?

i put function get_not_found_block(){} to page head
and try set
'formatNoMatches': 'get_not_found_block()'
or
'formatNoMatches': 'get_not_found_block'

stay same error

It is not possible to have javascript code in the select2 options passed in via django. If you need this functionality your best bet is to add your own script that overrides $.fn.select2.defaults