views.initializeComponents Function
A function that is executed when the view is rendered. It is used to initialize the components of the view with a custom content template.
Example
<div id="aiprompt"></div>
<script>
$("#aiprompt").kendoAIPrompt({
views: [
{
type: 'prompt',
promptSuggestions: [
"Act as [actor] and write [format] about [subject] in [100 words]",
"Suggest post about [subject] that will be used in [social media].",
],
},
"output",
{
type: 'commands',
promptCommands: [
{ id: "1", text: "Simplify", icon: "min-width" },
{ id: "2", text: "Extend", icon: "arrows-left-right" },
]
},
{
name: "custom",
type: "custom",
buttonIcon: "pencil",
buttonText: "Custom View from Options",
viewTemplate: () => "<div class='custom-view'>Custom View</div>",
footerTemplate: () => `<div class="k-actions k-actions-start k-actions-horizontal k-prompt-actions">
<button ref-custom-button>Click me</button>
</div>`,
initializeComponents: function() {
var that = this;
that.element.find("[ref-custom-button]").kendoButton({
click: function(e) {
console.log("Custom button clicked", e);
}
});
}
}]
})
</script>