zk - disable key controls for combobox

依然范特西╮ 提交于 2020-01-07 05:37:06

问题


Is it possible to disable the keyboard controls for a Combobox in ZK?

That is, when a user enters some text into a Combobox, by default they can use the arrow keys to move up and down the list. I would like to disable this functionally as it doesn't work well with the user experience we are designing.

I see nothing in the documentation explicitly.


回答1:


You can override _doKeyDown js function,

e.g.,

<zk xmlns:w="client">
    <combobox>
        <attribute w:name="_doKeyDown"><![CDATA[
            function (evt) {
                var keyCode = evt.keyCode;
                if (keyCode != 38 && keyCode != 40) {
                    this.$_doKeyDown(evt);
                }
            }
        ]]></attribute>
        <comboitem label="item one" />
        <comboitem label="item two" />
        <comboitem label="item three" />
    </combobox>
</zk>


来源:https://stackoverflow.com/questions/15947733/zk-disable-key-controls-for-combobox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!