Refreshing Page Content

Reloading page fragments while editing in place

With in-place editing, it is sometimes necessary to reload parts of a page so that changes that have been made to content become visible. To do this, call the Scrivito reload method on the DOM element concerned:

Copy
$("#my_dom_element").scrivito("reload")

This causes the specified DOM element to be reloaded by either reloading the entire page, one or more relevant parts, or just the DOM element in question. Do not make any assumptions about how much of the rest of the page is reloaded in addition to the specified elements.

Enabling in-place editing for a DOM element

After new CMS content has been loaded to a page using AJAX, in-place editing needs to be enabled for it manually. This can be achieved by triggering the content event like so:

Copy
scrivito.trigger("content", root_dom_element)

Pass the root element of the new content to the event. This may either be a DOM element or a jQuery instance.