Fetch HTML and Webix widget from server

I need to show HTML and Webix component which is fetched from server through Ajax and
render it in current page on click of button.

Please check the following article, especially the last chapter:

http://docs.webix.com/desktop__dynamic_layout.html#reloadinglayoutfromtheserver

Thanks for the response. Here is my problem,

I’m not getting json as response but it is HTML and JavaScript. Please refer following
snippet for response.

What I have created is window which is in fiddle.
https://jsfiddle.net/sanketgandhi876/0L47cmzo/2/

But I need to open above window on click of button from ajax response (It’s combination of HTML + Javascript so can’t use above solution which you mention)

Can you please help me in that.

Regards,

Sanket

Any help will be appreciated.

Hello, could you please share the snippet of data you get from server?

In general, you need to separate HTML and Javascript and pass some configuration to webix.ui, either it is json config or some HTML string (Webix supports initialization from markup, if it is what you are speaking about).

Hi,
This is response from server. http://pastebin.com/bp794Amv
My Question is, how should I show this component on my current page ? I have to
show this window on click of button.

P.S. I Don’t want to add this window (all javascript code in DOM) before click on button. Because my application have thousands of window and datatable so I can’t keep all javascript code in memory and render it whenever I click on button.

	function DOMEval( code, doc ) {
		doc = doc || document;

		var script = doc.createElement( "script" );

		script.text = code;
		doc.head.appendChild( script ).parentNode.removeChild( script );
	}

this is the way jQuery uses to invoke scripts. you can get script by webix.ajax and invoke it either by webix.exec or DOMEval

You should return just configuration from server, then it will be possible to initialize windows (as well as other components) on demand: http://webix.com/snippet/854d9cad

As for the styles, I’m afraid, you will have to load the complete style sheet at once.

Thanks @intregal and @Helga. This is very useful information, I use webix.exec() to render window on click of button. Looking forward to improve Webix Documentation as we are planning to move our application from ExtJs to Webix.

Thanks again,

Sanket