Attach a URL to Sidebar

In 5.X we had an option to use attachURL so that I can load the content of the sidebar item in the empty pane. How do I do it in 6.0?

Unfortunately currently we’re not planning to add such feature in the dhtmlxSuite 6.
You may place the iframe to the layout cell and attach an url to that iframe.

I didn’t quite understand. Can you please share some sample code to deal with this? Believe that the same thing may apply to all components.

Here is the code snippet demonstrating the principle:

		var layout = new dhx.Layout("layout", {
			width: "1220px",
			height: "1000px",
			css: "dhx_layout-cell--bordered",
			cols: [{
					padding: 0,
					id: "sidebar",
					width: "10%",
					header: "DHX sidebar",
				},
				{
					padding: 0,
					id: "frame",

					header: "some content",
					width: "90%"
				}
			]
		});
		var sidebar = new dhx.Sidebar(null);
			var data = [
    { 
        id: "dashboard", 
        value: "Dashboard", 
        icon: "mdi mdi-view-dashboard" 
    },
    {
        id: "statistics",
        value: "Statistics",
        icon: "mdi mdi-chart-line"
    },
    {
        id: "reports",
        value: "Reports",
        icon: "mdi mdi-file-chart"
    }
];


			sidebar.data.parse(data);
			layout.cell("sidebar").attach(sidebar);
			var html = "<iframe src='https://docs.dhtmlx.com/suite' width='100%' height='800px' align='left'>";
			layout.cell("frame").attachHTML(html);

This looks like a downgrade from previous version. What is the reason for the missing attachURL method?

1 Like

Our dev team decided to deprecate this method in order to minimize the size of the total dhtmlxSuite package, while you can achieve the same behavior without adding much additional code:
before:

layout.cell("frame").attachURL('https://docs.dhtmlx.com/suite');

now:

layout.cells("frame").attachHTML("<iframe src='https://docs.dhtmlx.com/suite'>");

Also this solution is much more flexible

What if I want to execute a php script instead of any html file?

it is not available to execute the php-script directly in the attachHTML() function.
this method is designed to display the html-content in your cell.
You may create your script in a separate php file and use it as an URL if it is needed.

Thanks much my query is resolved.