-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Lisbox in zk by default answers keystrokes like page up and page down, up and down keys and home and end keys. Ex: I want the currently selected row to come down when user hits down arrow. I gave all above keys in ctrlKeys attribute, to call the backend bean when specific keys are hit. But it doesn't call for above keys. It calls back end bean for keys like "delete". I want to disable the default behaviour for above keys for listbox in zk. Kindly help me. This is the ctrlKeys attribute I gave, ctrlKeys="#home#end#del#up#down#pgup#pgdn" onCtrlKey="@command('answerKeyStroke',keyCode=event.getKeyCode(), id=0)"
Hello Rao,
You can use the following example in order to capture the key event, and then you can add your own logic:
<?page title="Auto Generated index.zul"?>
<window title="Hello World!!" border="normal" width="200px">
<label value="You are using: ${desktop.webApp.version}"/>
<zk xmlns:w="client">
<listbox >
<attribute w:name="_doKeyDown"><![CDATA[
function (evt) {
var keyCode = evt.keyCode;
if (keyCode != 38 && keyCode != 40) {
this.$_doKeyDown(evt);
}
}
]]></attribute>
<listhead>
<listheader label="col 1" sort="auto" />
<listheader label="col 2" sort="auto" />
</listhead>
<listitem>
<listcell label="1.1" />
<listcell label="1.2" />
</listitem>
<listitem>
<listcell label="2.1" />
<listcell label="2.2" />
</listitem>
</listbox>
</zk>
</window>
Best Regards,
Darksu
Asked: 2015-07-12 08:42:34 +0800
Seen: 18 times
Last updated: Jul 16 '15
ZK Listbox Selectitems issue with Set
How to stop a bug from a listbox?
Cannot Change Listbox Header color & Background
Keyboard navigation in listbox
Can not display data in listbox
listbox with nonSelectabletags inplace new listitem
Input invoice using inline listbox
Change color to hover listitem listbox zk7 + Atlantic Theme
Listbox with autopaging causes constant row flickering
zk listbox getItems() returns null for item.getValue() if not scrolled fully