ui.combo with a gridsuggest clears typed in data

We have a client that doesnt like that when you start typing into the ui.combo, then click anywhere on the site, the typed in information clears. Is there a way I can prevent it from clearing the typed in data when the user goes to another form field?



  • edited December 2018


    There is not an easy solution. The point is that by default, all suggests will try to select the first value from the options list if the value in the input field doesn't match any option or remove typed value at all. This behavior is controlled by the getSuggestion method of the Suggest (and all dependent) widgets.
    So, you need to change this method by creating a custom gridsuggest:

            var id, list = this.getList(), order = list.data.order;
            if (list.getSelectedId) id = list.getSelectedId();
             if (!order.length){
                 $$("co").getInputNode().value = value;
               }, null, [$$("co").getText()])
              id = order[0];
            if (id && typeof id == "object") id = id+"";
                return id;
    }, webix.ui.gridsuggest);

    Please check the sample: https://snippet.webix.com/jtmbbe1b

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!

In this Discussion