LoadOnDemandPanel

Version: 9.0

You use the LoadOnDemandPanel control to load and render an item. The item is not loaded and rendered until you call the load member function.

The LoadOnDemandPanel control provides a number of triggers you can listen for in your code:

  • beforeSend

    The control raises this event before it makes an Ajax request. You can catch this event and write code that modifies the XMLHttpRequest object and sets additional headers, if you need to.

  • success

    The control raises this event if the Ajax request was successful (that is, the control did not receive errors from the server, and it did not detect errors in the data).

  • error

    The control raises this event if the Ajax request did not succeed. success and error are mutually exclusive.

  • complete

    The control always raises this event, for both successful and for failed requests and even for synchronous requests.

You use the LoadOnDemandPanel control to make SPEAK not load an item immediately. You can tell SPEAK to load the item in code. For example, you can tell SPEAK to load the item when a specific condition is met. You can also tell SPEAK to refresh (reload) an item it has previously loaded.

Properties

Name

Description

Default

Availability

Appearance

ItemId

Point to the item you want the control to load.

Client, Server

Database

Specify the database the control loads the item from. You can use the $context_database or $context_contentdatabase tokens, or you can name the database explicitly.

Client, Server

TriggerLoad

You use this property to set the client-side event from the server.

Server

IsLoaded

This read-only property is true when the control has loaded the item.

Client(read-only), Server

LoadOnVisible

If this property is true, the control loads content when the IsVisible property is true.

False

Server

View members – client-side events

View members represent events that the component either raises or listens to. You can listen for and raise events in the PageCode.

Name

Description

beforeSend

The control raises this event before it makes an Ajax request.

success

The control raises this event when it has made a successful request.

error

The control raises this event if it has received an error as response to a request.

complete

This event is called regardless of whether the request was successful or not. You will always receive a complete callback, even for synchronous requests.

Client-side methods

Client-side methods represent the list of methods exposed by control.

Name

Description

load

This method loads the content and sets the isLoaded property to true. If the content is already loaded, it will do nothing.

destroy

This method destroys the panel and all nested controls.

refresh

This method resets the isLoaded property and the call load method.

Do you have some feedback for us?

If you have suggestions for improving this article,