remove

Removes a component instance from memory.

Instance.remove

Arguments

None

Return Value

None

Exceptions

The following exception may be thrown:

  • uniface.InvalidInstanceException

Description

When the remove function is called in JavaScript, the following actions occur:

  • If the instance is attached to another component instance (for example, via a DSPContainer widget), it is detached.
  • If the instance has child instances, these are detached, but not deleted.

Detaching an instance fires the Detach trigger.

Consider the following DSP structure in which DSP1 is the main component instance. It has a DSPContainer widget that references instance DSP2, and DSP2 in its turn has a DSPContainer widget that references DSP3.

Structure of a DSP with contained DSPs

If you delete DSP2, the following actions are performed:

  1. DSP2 is detached from DSP1 and DSP2's Detach trigger (if defined) is executed asynchronously.
  2. The OnChange trigger (if defined) of FLD2 on DSP1 is executed asynchronously, because it's value is now null instead of DSP2.
  3. DSP3 is detached from DSP2and the DSP2's Detach trigger (if defined) is executed asynchronously.
  4. DSP2 is deleted from memory on the browser

Requests to execute the Detach and OnChange triggers are added to the command queue for asynchronous execution.

Related Topics