richselect control: responding to keypress event by scrolling to matching items

edited September 2017 in Technical questions

Is there a standard way to have a richselect control respond to a letter pressed by a user (keypress event) and scroll to the 1st matching item (i.e. starting with the pressed letter) in its list? I don't want to filter the list, just jump to the 1st matching item. I know I can listen to the keyevent and create this logic myself, but I just want to check that if I'm not overlooking a standard feature of this control

Comments

  • Hello,

    You can achieve this performance by taking the following steps:

    • tune suggest filtering function so that it always returns true, i.e. considers all the items as a match;
    • in the onAfterFilter handler of the list component find the 1st matching item and apply the select() and showItem() methods to it to highlight and scroll to the matched item respectively.

    You can check the solution in the related snippet: https://webix.com/snippet/aaef9834

  • Thank you Helga, I'll go with that.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!