Abstract
Optional
$ZKBINDER$Optional
$ZKMATCHMEDIA$Optional
$buttonOptional
$inputThe object ID. Each object has its own unique $oid. It is mainly used for debugging purpose.
Trick: you can test if a JavaScript object is a ZK object by examining this property, such as `if (o.$oid) alert('o is a ZK object');`
Notice: zk.Class extends from zk.Object (so a class also has $oid)
Optional
$weaveThe weave controller that is used by ZK Weaver. It is not null if it is created and controlled by ZK Weaver. In other words, it is called in the Design Mode if Widget.$weave is not null.
Optional
autagThe AU tag of this widget.
The AU tag tag is used to tag the AU requests sent by the peer widget.
For instance, if the AU tag is xxx,yyy
and the desktop's
request path (Desktop#requestPath) is /foo.zul
, then
the URL of the AU request will contain /_/foo.zul/xxx,yyy
,.
null
6.0.0
Readonly
bindThe bind level (integer).
The level in the widget tree after this widget is bound to a DOM tree (bind_). For example, a widget's bind level is one plus the parent widget's
It starts at 0 if it is the root of the widget tree (a desktop, zk.Desktop), then 1 if a child of the root widget, and son on. Notice that it is -1 if not bound.
It is mainly useful if you want to maintain a list that parent widgets is in front of (or after) child widgets. bind level.
Optional
blankThe class name of the widget. For example, zk.Widget's class name is "zk.Widget", while zul.wnd.Window's "zul.wnd.Window".
Notice that it is available if a widget class is loaded by WPD loader (i.e., specified in zk.wpd). If you create a widget class dynamically, you have to invoke register to make this member available. On the other hand, zk.Object.$class is available for all objects extending from zk.Object.
widgetName
Optional
Readonly
desktopThe desktop that this widget belongs to.
It is set when it is bound to the DOM tree.
Notice it is always non-null if bound to the DOM tree, while Widget.$n is always non-null if bound. For example, zul.utl.Timer.
It is readonly, and set automatically when bind_ is called.
Optional
domOptional
ebdfakerOptional
ebodyOptional
ebodyrowsOptional
ebodytblOptional
efootOptional
efootrowsOptional
efoottblOptional
efrozenOptional
eftfakerOptional
ehdfakerOptional
eheadOptional
eheadrowsOptional
eheadtblOptional
Readonly
firstThe first child, or null
if no child at all.
getChildAt
Optional
footOptional
frozenOptional
headOptional
Readonly
idReadonly
inWhether this widget has a peer component.
It is set if a widget is created automatically to represent a component
at the server. On the other hand, it is false if a widget is created
by the client application (by calling, say, new zul.inp.Textox()
).
Optional
Readonly
lastThe last child, or null
if no child at all.
getChildAt
Readonly
nThe number of children (integer).
Optional
Readonly
nextThe next sibling, or null
if this widget is the last child.
Optional
offsetOptional
offsetOptional
pagingOptional
Readonly
parentThe parent, or null
if this widget has no parent.
Optional
Readonly
previousThe previous sibling, or null
if this widget is the first child.
Optional
prologThe UUID. Don't change it if it is bound to the DOM tree, or inServer is true. Developers rarely need to modify it since it is generated automatically.
The widget name of the widget.
It is the same as this.className.substring(this.className.lastIndexOf('.') + 1).toLowerCase()
.
For example, if className is zul.wnd.Window, then
widgetName is window.
Notice that className is unique while widgetName is not necessary unique.
className
5.0.2
Optional
z$displayOptional
z$rodOptional
z$rod0Optional
z_Optional
z_Static
$oidStatic
Readonly
WIDTH0Static
auThe default delay before sending an AU request when fire is called (and the server has an ARAP event listener registered).
38
(Unit: miliseconds).
5.0.8
Static
moldsthe map of all fellows of this widget.
wgt.$f().main.setTitle("foo");
5.0.2
the widget's ID (id)
Optional
global: booleanwhether to search all ID spaces of this desktop. If true, it first search its own ID space, and then the other Id spaces in this browser window (might have one or multiple desktops). If omitted, it won't search all ID spaces.
the fellow (Widget) of the specified ID of the ID space that this widget belongs to. It returns undefined
if not found.
Determines if this object is an instance of the class represented by the specified Class parameter. Example:
if (obj.$instanceof(zul.wgt.Label, zul.wgt.Image)) {
}
Rest
...klass: any[]the Class object to be checked. Any number of arguments can be specified.
true if this object is an instance of the class
the DOM element that this widget is bound to. It is null if it is not bound to the DOM tree, or it doesn't have the associated DOM node (for example, zul.utl.Timer).
Notice that desktop is always non-null if it is bound to the DOM tree. In additions, this method is much faster than invoking jq() (see _global_.jq, since it caches the result (and clean up at the unbind_). ```ts var n = wgt.$n(); ```
#$n(String)
Optional
subId: stringthe sub ID of the child element
the child element of the DOM element(s) that this widget is bound to. This method assumes the ID of the child element the concatenation of uuid, -, and subId. For example,
var cave = wgt.$n('cave'); //the same as jq('#' + wgt.uuid + '-' + 'cave')[0]
Like Widget.$n, this method caches the result so the performance is much better than invoking jq() directly.
Optional
subclass: stringthe sub zclass name that cache for this widget. It returns the zclass if the subclass is empty or null, since it caches the result (and clean up at the setZclass).
var subzcls = wgt.$s('hover'); // z-xxx-hover will be return
Invokes a method defined in the superclass with any number of arguments. It is like Function's call() that takes any number of arguments.
Example: ```ts multiply: function (n) { return this.$super('multiply', n + 2); } ```
the object being returned by the method of the superclass.
Invokes a method defined in the superclass with any number of arguments. It is like Function's call() that takes any number of arguments.
It is similar to ZKObject.$super, but this method works even if the superclass calls back the same member method. In short, it is tedious but safer.
Example: ```ts foo.MyClass = zk.$extends(foo.MySuper, { multiply: function (n) { return this.$super(foo.MyClass, 'multiply', n + 2); } ```
Notice that the class specified in the first argument is not the super class having the method. Rather, it is the class that invokes this method.
the object being returned by the method of the superclass.
Invokes a method defined in the superclass with an array of arguments. It is like Function's apply() that takes an array of arguments.
Example: ```ts multiply: function () { return this.$supers('multiply', arguments); } ```
the object being returned by the method of the superclass.
Invokes a method defined in the superclass with an array of arguments. It is like Function's apply() that takes an array of arguments.
It is similar to zk.Object.$supers, but this method works even if the superclass calls back the same member method. In short, it is tedious but safer.
Example: ```ts foo.MyClass = zk.$extends(foo.MySuper, { multiply: function () { return this.$supers(foo.MyClass, 'multiply', arguments); } ```
Notice that the class specified in the first argument is not the super class having the method. Rather, it is the class that invokes this method.
the object being returned by the method of the superclass.
Specifies a function that shall be called after the object is initialized, i.e., after zk.Object.$init is called. This method can be called only during the execution of zk.Object.$init.
It is an advance feature that is used to allow a base class to do something that needs to wait for all deriving classes have been initialized.
Invocation Sequence:
the function to register for execution later
Append a child widget. The child widget will be attached to the DOM tree automatically, if this widget has been attached to the DOM tree, unless this widget is zk.Desktop. In other words, you have to attach child widgets of zk.Desktop manually (by use of, say, replaceHTML).
whether the widget was added successfully. It returns false if the child is always the last child (lastChild).
Binds this widget. It is called to associate (aka., attach) the widget with the DOM tree.
Notice that you rarely need to invoke this method, since it is called automatically (such as replaceHTML and appendChild).
Notice that you rarely need to override this method, either. Rather, override bind_ instead.
Checks if this widget can be activated (gaining focus and so on).
Optional
opts: Partial<{ the options. Allowed values:
return false if it is not a descendant of
{@link _global_.zk#currentModal}.
Clears the cached nodes (by Widget.$n).
Fire a widget event. An instance of zk.Event is created to represent the event.
The event listeners for this event will be called one-by-one unless zk.Event#stop is called.
If the event propagation is not stopped (i.e., zk.Event#stop not called) and inServer is true, the event will be converted to an AU request and sent to the server. Refer to ZK Client-side Reference: AU Requests: Client-side Firing for more information.
the event name, such as onClick
Optional
data: unknownthe data depending on the event (zk.Event).
Optional
opts: EventOptionsthe options. Refer to zk.Event#opts
Optional
timeout: numberthe delay before sending the non-deferrable AU request (if necessary). If not specified or negative, it is decided automatically. It is ignored if no non-deferrable listener is registered at the server.
the event being fired.
Fire a widget event.
the event to fire
Optional
timeout: numberthe delay before sending the non-deferrable AU request (if necessary). If not specified or negative, it is decided automatically. It is ignored if no non-deferrable listener is registered at the server.
the event being fired, i.e., evt.
Sets the focus to this widget. This method will check if this widget can be activated by invoking canActivate first.
Notice: don't override this method. Rather, override focus_, which this method depends on.
Optional
timeout: numberhow many milliseconds before changing the focus. If not specified or negative, the focus is changed immediately,
whether the focus is gained to this widget.
Forces the rendering if it is deferred. A typical way to defer the render is to specify setRenderdefer with a non-negative value. The other example is some widget might be optimized for the performance by not rendering some or the whole part of the widget. If the rendering is deferred, the corresponding DOM elements (Widget.$n) are not available. If it is important to you, you can force it to be rendered.
Notice that this method only forces this widget to render. It doesn't force any of its children. If you want, you have invoke forcerender one-by-one
The derived class shall override this method, if it implements the render deferring (other than setRenderdefer).
5.0.2
Converts a coordinate related to the browser window into the coordinate related to this widget.
the X coordinate related to the browser window
the Y coordinate related to the browser window
the coordinate related to this widget (i.e., [0, 0] is the left-top corner of the widget).
5.0.2
Abstract
getOptional
opts: Record<string, unknown>Called by insertChildHTML_ to find the location to place the DOM element of the child. More precisely, the node returned by getCaveNode is the parent DOM element of the child's DOM element.
this.$n('cave') || this.$n()
You can override it to return whatever DOM element you want.
insertChildHTML_
the index of the child widget to return. 0 means the first child, 1 for the second and so on.
Optional
skipHidden: booleanwhether to skip hidden child widgets, defaults to false.
the child widget at the specified index or null if no such index.
Notice this method is not good if there are a lot of children since it iterates all children one by one.
the child index of this widget. By child index we mean the order of the child list of the parent. For example, if this widget is the parent's first child, then 0 is returned.
Notice that getChildAt is called against the parent, while this method called against the child. In other words, `w.parent.getChildAt(w.getChildIndex())` returns `w`.
Notice this method is not good if there are a lot of children since it iterates all children one by one.
the ID of the popup (zul.wgt.Popup) that should appear when the user right-clicks on the element (aka., context menu).
null
(no context menu).
the self's head widget.
5.0.4
Abstract
getthe identifier of this widget, or null if not assigned. It is the same as id.
Optional
getthe ID of the popup (zul.wgt.Popup) that should appear when the user clicks on the element.
null
(no popup).
the DOM element that is used to hold the text, or null if this widget doesn't show any text.
return null (no text node).
<p>For example, {@link updateDomStyle_} will change the style
of the text node, if any, to make sure the text is displayed correctly.
<p>See also <a href="http://books.zkoss.org/wiki/ZK_Client-side_Reference/Component_Development/Client-side/Text_Styles_and_Inner_Tags">ZK Client-side Reference: Text Styles and Inner Tags</a>.
the ID of the popup (zul.wgt.Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment. The tooltip will automatically disappear when the mouse is moved away.
null
(no tooltip).
Inserts a child widget before the reference widget (the sibling
argument).
the child widget
Optional
sibling: Widget<HTMLElement>the sibling widget (the 'insert' point where the new widget will be placed before). If null or omitted, it is the same as appendChild
Optional
ignoreDom: booleanwhether the widget was added successfully. It returns false if the child is always the last child (lastChild).
whether turn on auto-paging facility when mold is "paging". If it is set to true, the setPageSize is ignored; rather, the page size(number of item count) is automatically determined by the height of this widget dynamically.
whether this widget is being bound to DOM. In other words, it returns true if bind is called against this widget or any of its ancestors.
5.0.8
Optional
opts: Partial<{ the options. If omitted, it checks only if the server registers any non-deferrable listener, and if the client register any listener. Allowed values:
if a listener is registered for the specified event.
Optional
opts: RealVisibleOptionsthe options. Allowed values:
if this widget is really visible, i.e., all ancestor widget and itself are visible.
Abstract
itemOptional
opts: Record<string, unknown>Registers listener(s) to the specified event. For example,
wgt.listen({
onClick: wgt,
onOpen: wgt._onOpen,
onMove: [o, o._onMove]
});
As shown above, you can register multiple listeners at the same time, and echo value in infos can be a target, a function, or a two-element array, where the first element is a target and the second the function. A target can be any object that this will reference to when the event listener is called. Notice it is not zk.Event#target. Rather, it is `this` when the listener is called.
If the function is not specified, the target must have a method having the same name as the event. For example, if `wgt.listen({onChange: target})` was called, then target.onChange(evt) will be called when onChange event is fired (by fire). On the other hand, if the target is not specified, the widget is assumed to be the target.
Optional
priority: numberthe higher the number, the earlier it is called. If omitted, 0 is assumed. If a widget needs to register a listener as the default behavior (such as zul.wnd.Window's onClose), -1000 is suggested
Optional
ctl: ZWatchControllerOptional
opts: Record<string, unknown>Proxies a member function such that it can be called with this object in a context that this object is not available. It sounds a bit strange at beginning but useful when passing a member of an object that will be executed as a global function.
Example: Let us say if you want a member function to be called periodically, you can do as follows. ```ts setInterval(wgt.proxy(wgt.doIt), 1000); //assume doIt is a member function of wgt ```
With proxy, when doIt is called, this references to wgt. On the other hand, the following won't work since this doesn't reference to wgt, when doIt is called. ```ts setInterval(wgt.doIt, 1000); //WRONG! doIt will not be called with wgt ```
Notice that this method caches the result so that it will return the same proxied function, if you pass the same function again.
a function that can be called as a global function
(that actually have this
referencing to this object).
Generates the HTML fragment for this widget. The HTML fragment shall be pushed to out. For example,
out.push('<div', this.domAttrs_(), '>');
for (var w = this.firstChild; w; w = w.nextSibling)
w.redraw(out);
out.push('</div>');
an array to output HTML fragments.
Technically it can be anything that has the method called push
Optional
skipper: Skipperit retrieves the redraw function associated with
the mold ({@link getMold}) and then invoke it.
The redraw function must have the same signature as this method.
Removes a child with more control. It is similar to removeChild except the caller could prevent it from removing the DOM element.
Notice that the associated DOM elements and unbind_ is called first (i.e., called before beforeParentChanged_, modifying the widget tree, ID space, and onChildRemoved_).
the child to remove.
Optional
ignoreDom: booleanwhether to remove the DOM element
whether it is removed successfully.
Replaces the specified DOM element with the HTML content generated this widget.
It is the same as jq(n).replaceWith(wgt, desktop, skipper)
.
The DOM element to be replaced can be Widget.$n or any independent DOM element. For example, you can replace a DIV element (and all its descendants) with this widget (and its descendants).
This method is usually used to replace a DOM element with a root widget (though, with care, it is OK for non-root widgets). Non-root widgets usually use appendChild and insertBefore to attach to the DOM tree[1]
If the DOM element doesn't exist, you can use jq.before or jq.after instead.
Notice that, both replaceHTML fires the beforeSize and onSize watch events (refer to zWatch).
If skipper is null. It implies the caller has to fire these two events if it specifies a skipper (that is how rerender is implemented).
the DOM element (DOMElement) or anything Widget.$ allowed.
Optional
desktop: Desktopthe desktop that this widget shall belong to. If omitted, it is retrieve from the current desktop. If null, it is decided automatically ( such as the current value of desktop or the first desktop)
Optional
skipper: Skipperit is used only if it is called by rerender
Optional
_trim_: booleanOptional
_callback_: CallableFunction[]Replaces this widget with the specified one. The parent and siblings of this widget will become the parent and siblings of the specified one.
Notice that replaceHTML is used to replace a DOM element that usually doesn't not belong to any widget. And, replaceWidget is used to replace the widget, and it maintains both the widget tree and the DOM tree.
Re-renders the DOM element(s) of this widget. By re-rendering we mean to generate HTML again (redraw) and then replace the DOM elements with the new generated HTML code snippet.
It is equivalent to replaceHTML(this.node, null, skipper).
It is usually used to implement a setter of this widget. For example, if a setter (such as `setBorder`) has to modify the visual appearance, it can update the DOM tree directly, or it can call this method to re-render all DOM elements associated with is widget and its descendants.
It is convenient to synchronize the widget's state with the DOM tree with this method. However, it shall be avoided if the HTML code snippet is complex (otherwise, the performance won't be good).
If re-rendering is required, you can improve the performance by passing an instance of zk.Skipper that is used to re-render some or all descendant widgets of this widget.
Optional
skipper: Skipperskip some portion of this widget to speed up the re-rendering. If not specified, rerender(0) is assumed (since ZK 6).
Re-renders after the specified time (milliseconds).
Notice that, to have the best performance, we use the single timer to handle all pending rerenders for all widgets. In other words, if the previous timer is not expired (and called), the second call will reset the expiration time to the value given in the second call.
Optional
timeout: numberthe number milliseconds (non-negative) to wait before rerender. If negative, it means rerender shall take place immediately. If not specified, 0 is assumed (since ZK 6).
5.0.4
Sets a property. The property updates sent from the server, including renderProperties and smartUpdate, will invoke this method.
If the name starts with `on`, it is assumed to be an event listener and setListener will be called.
If the name starts with `$on`, the value is assumed to be a boolean indicating if the server registers a listener.
If the name starts with `$$on`, it indicates the event is an important event that the client must send it back to the server. In additions, the value is assumed to be a boolean indicating if the server registers a listener.
If the value is in this format, it indicates `$u`'s value is UUID of a widget, and it will be resolved to a widget before calling the real method.
However, since we cannot resolve a widget by its UUID until the widget is bound (to DOM). Thus, ZK sets property after mounted. For example, `wgt.set("radiogroup", {$u: uuid})` is equivalent to the following. ```js zk.afterMount(function () { wgt.set("radiogroup", zk.Widget.$(uuid)) }); ```
the name of property.
the value
Sets a property. The property updates sent from the server, including renderProperties and smartUpdate, will invoke this method.
the name of property. Refer to (set:TWO_PARAMS) for special names.
the value
the extra argument. It could be anything.
Sets the client-side action.
Optional
action: stringthe client-side action
null
(no CSA at all)
The format:
`action1: action-effect1; action2: action-effect2`
Currently, only two actions are `show` and `hide`. They are called when the widget is becoming visible (show) and invisible (hide).
The action effect (`action-effect1`) is the name of a method defined in zk.eff.Actions, such as `show: slideDown; hide: slideUp`
5.0.6
Sets whether turn on auto-paging facility when mold is "paging". If it is set to true, the setPageSize is ignored; rather, the page size(number of item count) is automatically determined by the height of this widget dynamically.
Optional
opts: Record<string, boolean>Sets the ID of the popup (zul.wgt.Popup) that should appear when the user right-clicks on the element (aka., context menu).
the ID of the popup widget.
Sets the ID of the popup (zul.wgt.Popup) that should appear when the user right-clicks on the element (aka., context menu).
An onOpen event is sent to the context menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.
Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).
If there are two components with the same ID (of course, in
different ID spaces), you can specify the UUID with the following
format:
`uuid(comp_uuid)`
Example:
```ts
wgt.setContext('an_id');
wgt.setContext('uuid(an_uuid)');
wgt.setContext(a_wgt);
```
Both reference a component whose ID is "some".
But, if there are several components with the same ID,
the first one can reference to any of them.
And, the second one reference to the component in the same ID space
(of the label component).
The context menu can be shown by a position from zul.wgt.Popup.open or the location of `x` and `y`, you can specify the following format:
the popup widget.
Sets what keystrokes to intercept.
The string could be a combination of the following:
For example,
Sets the identifier of a draggable type for this widget.
Optional
draggable: string | boolean"false", "" or null to denote non-draggable; "true" for draggable with anonymous identifier; others for an identifier of draggable.
null
The simplest way to make a widget draggable is to set this property to "true". To disable it, set this to "false" (or null). If there are several types of draggable objects, you could assign an identifier for each type of draggable object. The identifier could be anything but empty and "false".
Sets the identifier, or a list of identifiers of a droppable type for this widget.
Optional
droppable: string | booleanfalse
, null
or ""
to denote not-droppable; true
for accepting any draggable types; a list of identifiers, separated by comma for identifiers of draggables this widget accept (to be dropped in).
null
The simplest way to make a component droppable is to set this attribute to `true`. To disable it, set this to `false` (or `null`).
If there are several types of draggable objects and this widget accepts only some of them, you could assign a list of identifiers that this widget accepts, separated by comma.
For example, if this component accepts dg1 and dg2, then assign "dg1, dg2" to this attribute.
Sets horizontal flexibility hint of this widget.
The parameter flex is a number in String type indicating how this widget's parent container distributes remaining empty space among its children widget horizontally. Flexible widget grow and shrink to fit their given space. Flexible widget with larger flex values will be made larger than widget with lower flex values, at the ratio determined by all flexible widgets. The actual flex value is not relevant unless there are other flexible widget within the same parent container. Once the default sizes of widget in a parent container are calculated, the remaining space in the parent container is divided among the flexible widgets, according to their flex ratios.
Specify a flex value of negative value, 0, or "false" has the same effect as leaving this flex attribute out entirely. Specify a flex value of "true" has the same effect as a flex value of 1.
Special flex hint, "min", indicates that the minimum space shall be given to this flexible widget to enclose all of its children widgets. That is, the flexible widget grow and shrink to fit its children widgets.
Optional
hflex: string | booleanthe horizontal flex hint.
Sets the inner width of this component. The inner width is the width of the inner table. By default, it is 100%. That is, it is the same as the width of this component. However, it is changed when the user is sizing the column's width.
Application developers rarely call this method, unless they want to preserve the widths of sizable columns changed by the user. To preserve the widths, the developer have to store the widths of all columns and the inner width (getInnerWidth), and then restore them when re-creating this component.
the inner width. If null, "100%" is assumed.
Optional
opts: Record<string, boolean>Sets a listener that can be unlistened easily. It is designed to be called from server. For client-side programming, it is suggested to use listen.
It is based listen, but, unlike listen, the second invocation for the same event will unlisten the previous one automatically.
In additions, if the function (specified in the second element of inf) is null, it unlistens the previous invocation.
Sets a listener It is designed to be called from server. For client-side programming, it is suggested to use listen. Use it only if you want to unlisten the listener registered at the server (by use of the client namespace).
It is based listen, but, unlike listen, the second invocation for the same event will unlisten the previous one automatically.
In additions, if fn is null, it unlistens the previous invocation.
the listener function. If null, it means unlisten.
Sets the listener a map of listeners. It is similar to listen, except
This method is mainly designed to be called by the application running at the server.
Example: ```ts wgt.setListeners({ onChange: function (event) {this.doSomething();}, onFocus: 'this.doMore();', onBlur: null //unlisten }); ```
Sets the external Paging widget.
Optional
paginal: PagingSets how to position the paging of the widget at the client screen. It is meaningless if the mold is not in "paging".
how to position. It can only be "bottom" (the default), or "top", or "both".
Optional
opts: Record<string, boolean>Sets the ID of the popup (zul.wgt.Popup) that should appear when the user clicks on the element.
the ID of the popup widget.
Sets the ID of the popup (zul.wgt.Popup) that should appear when the user clicks on the element.
An onOpen event is sent to the popup menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.
Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).
If there are two components with the same ID (of course, in
different ID spaces), you can specify the UUID with the following
format:
`uuid(comp_uuid)`
Example:
```ts
wgt.setPopup('an_id');
wgt.setPopup('uuid(an_uuid)');
wgt.setPopup(a_wgt);
```
Both reference a component whose ID is "some".
But, if there are several components with the same ID,
the first one can reference to any of them.
And, the second one reference to the component in the same ID space
(of the label component).
The popup menu can be shown by a position from zul.wgt.Popup.open or the location of `x` and `y`, you can specify the following format:
the popup widget.
Sets the number of milliseconds before rendering this component at the client.
time to wait in milliseconds before rendering. Notice: 0 also implies deferring the rendering (just right after all others are rendered).
-1 (don't wait).
This method is useful if you have a sophisticated page that takes long to render at a slow client. You can specify a non-negative value as the render-defer delay such that the other part of the UI can appear earlier. The styling of the render-deferred widget is controlled by a CSS class called `z-render-defer`.
Notice that it has no effect if the component has been rendered at the client.
5.0.2
Sets the CSS class of this widget.
the style class
null
The default styles of ZK components doesn't depend on sclass at all. Rather, setSclass is provided to perform small adjustment, e.g., changing only the font size. In other words, the default style is still applied if you change sclass.
To replace the default style completely, use setZclass instead.
The real CSS class is a concatenation of getZclass and getSclass.
Sets whether sizing the widget column width by its content. Default is false, i.e. the outline of the widget is dependent on browser. It means, we don't calculate the width of each cell. If set to true, the outline will count on the content of body. In other words, the outline of the widget will be like ZK version 2.4.1 that the header's width is only for reference.
You can also specify the "sized-by-content" attribute of component in lang-addon.xml directly, it will then take higher priority.
Optional
opts: Record<string, boolean>Sets column span hint of this mesh widget.
The parameter span is a number in String type indicating how this component distributes remaining empty space to the specified column(0-based). "0" means distribute remaining empty space to the 1st column; "1" means distribute remaining empty space to the 2nd column, etc.. The spanning column will grow to fit the extra remaining space.
Special span hint with "true" means span ALL columns proportionally per their original widths while null or "false" means NOT spanning any column.
the column span hint.
Optional
opts: Record<string, boolean>null
. That is, NOT span any column.
Note span is meaningful only if there is remaining empty space for columns.
5.0.6
Sets the ID of the popup (zul.wgt.Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.
the ID of the popup widget.
Sets the ID of the popup (zul.wgt.Popup) that should be used as a tooltip window when the mouse hovers over the element for a moment.
An onOpen event is sent to the tooltip if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based on OpenEvent.getReference) by listening to the onOpen event.
Note: To simplify the use, it not only searches its ID space, but also all ID spaces in the desktop. It first searches its own ID space, and then the other Id spaces in the same browser window (might have one or multiple desktops).
If there are two components with the same ID (of course, in
different ID spaces), you can specify the UUID with the following
format:
`uuid(comp_uuid)`
Example:
```ts
wgt.setTooltip('an_id');
wgt.setTooltip('uuid(an_uuid)');
wgt.setTooltip(a_wgt);
```
Both reference a component whose ID is "some".
But, if there are several components with the same ID,
the first one can reference to any of them.
And, the second one reference to the component in the same ID space
(of the label component).
The tooltip can be shown by a position from zul.wgt.Popup.open or the location of `x` and `y`, and can be specified with a delay time (in millisecond), you can specify the following format:
Sets the top of this widget.
If you want to specify bottom
, use setStyle instead.
For example, setStyle("bottom: 0px");
the top. Remember to specify 'px', 'pt' or '%'. An empty or null value means "auto"
Makes this widget as topmost.
If this widget is not floating, this method will look for its ancestors for the first ancestor who is floating. In other words, this method makes the floating containing this widget as topmost. To make a widget floating, use setFloating_.
This method has no effect if it is not bound to the DOM tree, or none of the widget and its ancestors is floating.
Notice that it does not fire onFloatUp so it is caller's job if it is necessary to close other popups.
the new value of z-index of the topmost floating window, -1 if this widget and none of its ancestors is floating or not bound to the DOM tree.
setFloating_
Sets vertical flexibility hint of this widget.
The parameter flex is a number in String type indicating how this widget's parent container distributes remaining empty space among its children widget vertically. Flexible widget grow and shrink to fit their given space. Flexible widget with larger flex values will be made larger than widget with lower flex values, at the ratio determined by all flexible widgets. The actual flex value is not relevant unless there are other flexible widget within the same parent container. Once the default sizes of widget in a parent container are calculated, the remaining space in the parent container is divided among the flexible widgets, according to their flex ratios.
Specify a flex value of negative value, 0, or "false" has the same effect as leaving the flex attribute out entirely. Specify a flex value of "true" has the same effect as a flex value of 1.
Special flex hint, "min", indicates that the minimum space shall be given to this flexible widget to enclose all of its children widgets. That is, the flexible widget grow and shrink to fit its children widgets.
Optional
vflex: string | booleanthe vertical flex hint.
Sets whether this widget is visible.
whether to be visible
Sets the Z index.
the Z index to assign to
if opts.fire is specified the onZIndex event will be triggered. If opts.floatZIndex is false, represent it is not from setFloatZIndex, so the userZIndex may be true.
Sets the ZK Cascading Style class(es) for this widget. It is the CSS class used to implement a mold of this widget. n implementation It usually depends on the implementation of the mold (getMold).
the style class used to apply the whole widget.
null
but an implementation usually provides a default class, such as z-button.
Calling setZclass with a different value will completely replace the default style of a widget. Once you change it, all default styles are gone. If you want to perform small adjustments, use setSclass instead.
The real CSS class is a concatenation of getZclass and getSclass.
Smart-updates a property of the peer component associated with this widget, running at the server, with the specified value.
It is actually fired an AU request named `setAttr`, and it is handled by the `updateByClient` method in `org.zkoss.zk.ui.AbstractComponent` (at the server).
By default, it is controlled by a component attribute called `org.zkoss.zk.ui.updateByClient`. And, it is default to false. Thus, the component developer has to override `updateByClient` at the server (in Java) and then update it rather than calling back superclass. For example, ```ts void updateByClient(String name, Object value) { if ("disabled".equals(name)) setDisabled(value instanceof Boolean && ((Boolean)value).booleanValue()); else super.updateByClient(name, value); } ```
the property name
the property value
Optional
timeout: numberthe delay before sending out the AU request. It is optional. If omitted, -1 is assumed (i.e., it will be sent with next non-deferrable request).
Synchronizes the size immediately. This method is called automatically if the widget is created at the server (i.e., inServer is true). You have to invoke this method only if you create this widget at client and add or remove children from this widget.
5.0.8
Unbinds this widget. It is called to remove the association (aka., detach) the widget from the DOM tree.
Notice that you rarely need to invoke this method, since it is called automatically (such as replaceHTML).
Notice that you rarely need to override this method, either. Rather, override unbind_ instead.
Removes a listener from the specified event.
wgt.unlisten({
onClick: wgt,
onOpen: wgt._onOpen,
onMove: [o, o._onMove]
});
a map of event listeners. Each key is the event name, and each value can be the target, the listener function, or a two-element array, where the first element is the target and the second the listener function.
Synchronizes a map of objects that are associated with this widget, and they shall be resized when the size of this widget is changed.
It is useful to sync the layout, such as shadow, mask and error message, that is tightly associated with a widget.
Optional
opts: ZKObjectthe options, or undefined if none of them specified.
Allowed values:
Static
$Retrieves the widget.
Optional
n: null | string | Node | JQuery<HTMLElement> | Event | Event<unknown> | Tthe object to look for. If it is a string,
it is assumed to be UUID, unless it starts with '$'.
For example, zk.Widget.$('uuid')
is the same as zk.Widget.$('#uuid')
,
and both look for a widget whose ID is 'uuid'. On the other hand,
zk.Widget.$('$id')
looks for a widget whose ID is 'id'.
and zk.Widget.$('.className')
looks for a widget whose CSS selector is 'className'. (since zk 8.0)
If it is an DOM element (DOMElement), it will look up
which widget it belongs to.
If the object is not a DOM element and has a property called
target
, then target
is assumed.
Thus, you can pass an instance of jq.Event or zk.Event,
and the target widget will be returned.
Optional
opts: Partial<{ the options. Allowed values:
Static
disableStatic
enableStatic
getStatic
getStatic
getthe widget name widgetName.
all DOMElement with the given widget name.
5.0.2
Static
getStatic
getStatic
isDetermines if the class by this Class object is either the same as, or is a superclass of, the class represented by the specified Class parameter. Example:
if (klass1.isAssignableFrom(klass2)) {
}
the Class object to be checked, such as zk.Widget.
true if assignable
Static
isStatic
isDetermines if the specified Object is assignment-compatible with this Class. This method is equivalent to [[zk.Object#$instanceof]. Example:
if (klass.isInstance(obj)) {
}
the object to check
true if the object is an instance
Static
newCreates a widget by specifying the widget name. The widget name is the last part of the class name of a widget (and converting the first letter to lower case). For example, if a widget's class name is zul.inp.Textbox, then the widget name is textbox.
This method is usually used by tools, such as zk.zuml.Parser, rather than developers, since developers can create the widget directly if he knows the class name.
the widget name, such as textbox.
Optional
props: Record<string, unknown>the properties that will be passed to Widget.$init.
Static
nextthe next unique UUID for a widget. The UUID is unique in the whole browser window and does not conflict with the peer component's UUID.
This method is called automatically if Widget.$init is called without uuid.
Static
registerRegisters a widget class. It is called automatically if the widget is loaded by WPD loader, so you rarely need to invoke this method. However, if you create a widget class at run time, you have to call this method explicitly. Otherwise, className, getClass, and newInstance won't be applicable.
Notice that the class must be declared before calling this method. In other words, zk.$import(clsnm) must return the class of the specified class name. ```ts zk.Widget.register('foo.Cool'); //class name zk.Widget.getClass('cool'); //widget name ```
the class name, such as zul.wnd.Window
Static
uuid
A skeletal implementation for a mesh widget.
See