February 2012
Beginner to intermediate
272 pages
6h 20m
English
If we change a large group of HTML including lots of widgets, for example,
creating various collapsible elements
based on a JSON file received by AJAX, we have to refresh the whole
container. The same happens if, for example, we add a couple of input elements to a current form and we want
them to be converted to widgets, as if they were in the page from the
beginning.
To refresh a container, so every widget can check again if there are
instances to create, we can trigger the create event on the
page.
For example:
$("#content").html(newHTMLcontentWithWidgets);
$("#page1").trigger("create");Every widget constructor is usually handling the page’s create event, so it will detect again if there
are controls to create.