-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I have found, that the empty listbox vertical size computation is not correct in the sel.js (zul.jar). I subtract -4 from the header:
/* Height of the head row. If now header, defval is returned. */ zk.Selectable.prototype._headHgh = function (defVal) { var hgh = this.head ? this.head.offsetHeight - 4 : 0; if (this.paging) { var pgit = $e(this.id + "!pgit"), pgib = $e(this.id + "!pgib"); if (pgit) hgh += pgit.offsetHeight; if (pgib) hgh += pgib.offsetHeight; } return hgh ? hgh: defVal; };
and now it works fine. However, I do not know, how to load this piece of javascript just right after the sel.js is loaded. Is there such an option in ZK 3.6? Maybe zk.addBeforeInit()? Or do I have to hack the file sel.js in the zul.jar?
Thanks with any help
Andy
Just bumping this thread ... does anybody know, it if there is an simple way, how to override just one JavaScript widget function in ZK 3.6.5? Thanks.
the way you've used is correct, in ZK 3.6.5, we only save component info on the server, so the concern of javascript is handling DOM structure.
Hi RyanWu,
thanks for the answer. But my concern is, where to put my zk.Selectable.prototype._headHgh() function. I do not want to change the zul.jar, bacause it's not good for ZK upgrades. And the sel.zul is loaded dynamically when the list box is used first. So I would like to know, it there is some some kind of event of hook "afterload" of JavaScript modules, where I can put my zk.Selectable.prototype._headHgh().
Thanks
you can do like this
zk.addInitLater(function () { // do something... });
Hi Ryan,
zk.addInitLater does not help me. When my page is loaded, there is no listbox, so the sel.js is not loaded. Then the page is changed by Executions.createComponents() and Include component. The sel.js is loaded when the first listbox is displayed and it depends on the user action. So I need some hook "afterLoad("sel.js", function())" or something like that.
I find this on-demand loading of *.js files great, but I cannot find any "afterLoad" and "beforeLoad" hooks.
you can use zk.load("zul.sel", function () {})
Hi Ryan,
the correct function is
zk.addOnLoad("zul.sel", function() {});
Thanks very much for your help and pointing me to the right direction.
FYI the correct patch for the sel.zul is:
zk.Selectable.prototype._headHgh = function (defVal) { var hgh = this.head ? this.head.offsetHeight : 0; if (hgh > 8) { // correction: -4 if possible (if head exists and is visible) hgh -= 4; } if (this.paging) { var pgit = $e(this.id + "!pgit"), pgib = $e(this.id + "!pgib"); if (pgit) hgh += pgit.offsetHeight; if (pgib) hgh += pgib.offsetHeight; } return hgh ? hgh: defVal; };
Asked: 2011-01-31 06:41:42 +0800
Seen: 362 times
Last updated: Feb 24 '11