Skip to content

Instantly share code, notes, and snippets.

@simonbbyrne
Created June 8, 2022 10:29
Show Gist options
  • Save simonbbyrne/fb89539fef438a65b335eaafc9b10092 to your computer and use it in GitHub Desktop.
Save simonbbyrne/fb89539fef438a65b335eaafc9b10092 to your computer and use it in GitHub Desktop.
Select2 no results template
### _____
| _ \(_)___ _ __ | | __ _ _ _
| | | | / __| _ \| |/ _ | | | |
| |_| | \__ \ |_) | | (_| | |_| |
|____/|_|___/ .__/|_|\__,_|\__, |
|_| |___/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ###
NoResultsTemplate: =>
return $('
<div class="empty-state" style="text-align:center;">
<img src="image.svg"/>
<p>You have no task list templates</p>
<a href="#">Create template</a>
</div>
')
<select class="form-control" data-bind="select2: {
placeholder: 'Select a template',
minimumResultsForSearch: 20,
width: '100%',
language: {
noResults: NoResultsTemplate
}
}">
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment