3

I'm following this sample to create a suggest control attached to text field:

webix.ui({
  view: "suggest",
  input: $$("testText"),
  body:{
    dataFeed:"/data.php"
  }
});

The datafeed property sends the request to the server and returns the filtered data. Th request is

"data.php?filter[value]=Ar"  // where 'Ar' is a typed text

But what if I need to limit the minimal number of typed symbols to send the request? For example, I want to reload the data when more than 3 characters are typed.

It possible or do I need to write my own method? How to do that?

Thanks in advance for any hint.

1 Answers1

1

This seems not to be trivial, I found this solution on the webix forum :

body:{
    dataFeed: function(filtervalue){
        if(filtervalue.length<3) return;
        var urldata = "filter[value]="+encodeURIComponent(filtervalue);
        this.load("http://docs.webix.com/samples/13_form/01_controls/server/data.php?"+urldata, this.config.datatype);
    }
}

Demo snippet : http://webix.com/snippet/4019c87a

fabien-michel
  • 1,873
  • 19
  • 38
  • I *think* (but you never really know when it comes to Webix documentation) that this is using ["Datafeed as function"](https://docs.webix.com/api__link__dataloader_datafeed_config.html). – Dan Dascalescu Aug 18 '19 at 03:47