问题
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