mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-30 20:42:34 +02:00
New callback to allow user to customize templates.
This commit is contained in:
parent
f386198ac0
commit
d8ab04b7f8
893
assets/scripts/dist/choices.js
vendored
893
assets/scripts/dist/choices.js
vendored
File diff suppressed because it is too large
Load diff
2
assets/scripts/dist/choices.js.map
vendored
2
assets/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
6
assets/scripts/dist/choices.min.js
vendored
6
assets/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -102,6 +102,7 @@ export default class Choices {
|
|||
callbackOnRemoveItem: null,
|
||||
callbackOnHighlightItem: null,
|
||||
callbackOnUnhighlightItem: null,
|
||||
callbackOnCreateTemplates: null,
|
||||
callbackOnChange: null,
|
||||
callbackOnSearch: null,
|
||||
};
|
||||
|
@ -2026,7 +2027,15 @@ export default class Choices {
|
|||
},
|
||||
};
|
||||
|
||||
this.config.templates = templates;
|
||||
// User's custom templates
|
||||
const callbackTemplate = this.config.callbackOnCreateTemplates;
|
||||
let userTemplates = {};
|
||||
if (callbackTemplate) {
|
||||
if (isType('Function', callbackTemplate)) {
|
||||
userTemplates = callbackTemplate(this, strToEl);
|
||||
}
|
||||
}
|
||||
this.config.templates = extend(templates, userTemplates);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue