Bind Events

In the Landing Page, Panel Page, Header Configuration and Footer Configuration, once the template is rendered with contents via DOM, the events like click, focus, focus out, double-click can be included to the contents to make an action.


For example, if the Landing Page template is loaded with workspaces and if the workspace needs to be clicked to open its subworkspaces, a click event can be binded to initiate the click and load the subworkspaces.


Example:

applyTemplate: function(template, tmpClass) {

	if (!canvas.core.isEmpty(this.parentElem)) {
		$(this.parentElem).append(template); 
	} 
	$(this.parentElem).find('.workspaceIconBlock').on('click', function(e) {
		var workspaceID = $(this).attr('data-itemid');
		canvas.workspace.metadata.getWorkspaceManager().getContainer().switchWorkspace(workspaceID);
});