0

[Help]use Enter on listbox

asked 2014-07-21 02:18:52 +0800

unitcell gravatar image unitcell
28 4

Hi all,

we know press TAB key to change input field to next field on listbox, how do I change to use Enter to replace the TAB ?

Thanx.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-21 07:46:04 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

You have to check the keyboard event manually. First, declare the CR event inside your zul page:

<textbox value="@bind(cellValue)" 
onOK="@command('edit-next-field', component=self)" inplace="true" />

Then in your view model you have to implement the command to handle the event:

@Command("edit-next-field")
public void onEditNextField(@BindingParam("component") Component component) {
  Component sibling = component.getNextSibling();

  if (sibling instanceof Textbox) {
    Textbox tb = (Textbox)sibling;
    tb.setFocus(true);
  }
  else if (sibling == null) {
    Component parent = component.getParent();
    Component nextRow = parent.getNextSibling();
    if (nextRow instanceof Row) {
        Textbox tb = (Textbox)nextRow.getFirstChild();
        tb.setFocus(true);
    }
  }

}

Hope that helps

Costas

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: 2014-07-21 02:18:52 +0800

Seen: 9 times

Last updated: Jul 21 '14

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