Is it possible to have a webix object inside another webix template?

So long story short let say you have a webix object that has a view type of template, and you want a webix object to be the templated html?:

template {
    view: "template",
    template: webix.ui({view:button})
}

problem is when I do something like that, it gets printed as [button HTMLobject] instead of the actually object with it’s properties. and if we were to do like a webix.ui({view:button}). getInputNode() that would print out the html but not the properties of a webix object. like if I were to add a click event to the button, then that click event won’t be in.

so is there a way to make that happen?

Hello,
If you want to use button in template you need class='webixbutton'

https://snippet.webix.com/y50jbphk

Hi Nastja,

Thanks for your response. I think its a start but I’m still a little confused. In the example shown there are 2 button shown, and if I add a click handler to the button: click:"alert('Hello! I am an alert box!!') we get the button with the function piece however we still have 2 buttons, a click button that doesn’t do anything and a longer button that does the alert? Also what if the template needs the data property for displaying its information, and not the label for the button? I do appreciate the reply tho!

Please note that the “webixbutton” CSS class just creates an HTML element resembling UI button, it’s not a Webix button in its essence.

So, to catch click actions, you need to add the onClick property to the template config, where you can attach click handlers for HTML areas defined by this or that CSS class: https://snippet.webix.com/6ai7jxsb

At the same time, if need to render other Webix views in place of UI template, you will need to dynamically replace this template with the desired widget.