JS API Constructor information

14 views
Skip to first unread message

Vincent Vinet

unread,
Jul 9, 2010, 11:23:47 AM7/9/10
to zkuery
Hello,

There does not seem to be any constructor information for widgets in
the jsdocs...

is that information available elsewhere, or is the preferred way of
creating widgets through parsing ZUML?

Thanks

Tom

unread,
Jul 9, 2010, 11:50:54 AM7/9/10
to zkuery
The constructor with ZKuery is $init. You could take a look at
http://www.zkoss.org/javadoc/latest/jsdoc/zk/Widget.html#$init%28_global_.Map%29

Complete JS API:
http://www.zkoss.org/javadoc/latest/jsdoc/

Here is an example of jq.alert:

jq.alert = function (msg, opts) {
if (opts && opts.mode == 'os')
return $alert(msg);

opts = opts || {};
zk.load("zul.wnd,zul.wgt,zul.box", function () {
var wnd = new zul.wnd.Window({
closable: true,
width: '250pt',
title: opts.title||'ZK',
border: 'normal',
children: [
new zul.box.Box({
mold: 'horizontal',
children: [
new zul.wgt.Div({sclass: icons[(opts.icon||'').toUpperCase()]||
icons.INFORMATION}),
new zul.wgt.Div({
sclass: 'z-messagebox',
width: '210pt',
children: [
new zul.wgt.Label({
value: msg,
multiline: true
})
]
})
]
}),
new zul.wgt.Separator({bar: true}),
new zul.box.Box({
mold: 'horizontal',
style: 'margin-left:auto; margin-right:auto',
children: getButtons(opts.button)
})
],
mode: opts.mode||'modal'
});

var p = opts.desktop || zk.Desktop.$();
if (p && (p = p.firstChild) && p.desktop)
p.appendChild(wnd);
else
jq(document.body).append(wnd);
});
};
Reply all
Reply to author
Forward
0 new messages