combo keyPressTimeout

How can I set the keyPressTimeout property on a combo using suggest list?

{
view:“combo”,
id: “mycombo_cb”,
required: true,
label: “mycombo”,
name: “idCombo”,
suggest: “service/myService.php”
}

Hello,

You can set keyPressTimeOut via complex combo configuration:

view:"combo", options:{
    keyPressTimeout:1000,
    data:[
      {id:1, value:"One"},
      {id:2, value:"Two"},
      {id:3, value:"Three"}
    ]
  }

http://webix.com/snippet/20405d3a

Thanks… I still have a problem if I try to load the data from my service:

view:“combo”, options:{
keyPressTimeout:1000,
data:“service/myService.php”
}

I have this error: Data loading error

Using suggest: “service/myService.php” everything works well but I can’t set keyPressTimeout.

Do I use the right syntax?

Sorry, I misled you (in order to show everything in the snippet). Actually, url data is set by url property, data is for parsing inline data into the component.

view:"combo", options:{ keyPressTimeout:1000, url:"service/myService.php" }

It works :slight_smile: thanks!

I’ve noticed now that while with using suggest:“service/myService.php” the filter is made server side with a new call, using url:“service/myService.php” the filter is client side.
Is it possible to have keyPressTimeout using server side filtering?

Well, it’s possible, but do you really handle the requests on your server side?

You can redefine the function that fires when filtering starts and instead of filtering on client-side, issue a request with the needed parameters.

{ view:"combo", options:{
        //item -  option item object, value - current text in the input
        filter:function(item, value){
            var url = this.getBody().config.url;
           //data - is a 'promise' object
            var data = webix.ajax().get(url+"?filter[value]="+value);
            this.getBody().clearAll();
            this.getBody().parse(data);
         },
         keyPressTimeout:1000,
         body:{
               url:"server/data.json"
         }
 }}

The result of an asynchronous Ajax operation is parsed directly in the component because Webix uses Promise API.

Such a complex configuration for combo and richselect in the described in the docs http://docs.webix.com/desktop__advanced_combo.html