0

Is it possible to remove focus from ZK combobox after list appears?

asked 2015-12-18 01:20:49 +0800

gooamoko gravatar image gooamoko
5 2

updated 2015-12-21 08:58:06 +0800

Hi.

Not so long ago I asked about removing blinking cursor from Datebox.

forum.zkoss.org/question/99670/zk-datebox-cursor-appears-through-popup-window-in-ie-10/

I tried same strategy for Combobox

zk.afterLoad('zul.inp', function () {       
    zul.inp.InputCtrl.isPreservedFocus = function (wgt) {
    return wgt.widgetName == "combobox" ? false : true };
});

and I am in trouble.

How can I remove focus from combobox's input after the popup list appears? Is it possible? I think that if focus will be removed, blinking curcor doesn't appears behind popup list.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-12-21 13:56:54 +0800

gooamoko gravatar image gooamoko
5 2

Seems like I solve it!

New idea is to override method open of ZKoss's Combobox.

var _Cwgt = {};
zk.override(zul.inp.Combobox.prototype, _Cwgt, {
  open: function (silent) {
    var id = '#' + this.uuid + '-pp'; // get id of popup
    _Cwgt.open.apply(this, arguments); // call original
    jq(id).focus(); // give focus to the popup
  }
});

that's it.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-12-18 01:20:49 +0800

Seen: 41 times

Last updated: Dec 21 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More