EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: volodias on September 16, 2013, 11:01:47 PM



Title: how to load easyui-combobox data after typing 1-2 symbols
Post by: volodias on September 16, 2013, 11:01:47 PM
Hello!

I have an easyui-combobox. It's loading with PHP script and the amount of entries is ~2000.
Is it possible to let user input 1-2 leading chars and only after that to load with PHP scrips the records to the combobox? Thus, the result set will be much smaller in my case.

I have tried many combinations to pass Q parameters, but without success.

Greetings.


Title: Re: how to load easyui-combobox data after typing 1-2 symbols
Post by: mzeddd on September 17, 2013, 01:12:13 AM
Hi,

Just check size in PHP and 'die' if it is too small


Title: Re: how to load easyui-combobox data after typing 1-2 symbols
Post by: volodias on September 17, 2013, 01:32:45 AM
Hi, thanks for reply.

Yes, this should work, but maybe there is more elegant local side solution with JS?

Well, if NOT - will do this way.


Title: Re: how to load easyui-combobox data after typing 1-2 symbols
Post by: stworthy on September 17, 2013, 06:21:10 PM
The 'onBeforeLoad' event can be used to prevent from sending request to server regarding some conditions. To let users enter at least 2 chars, detect the 'q' parameter's length in 'onBeforeLoad' event.
Code:
$('#cc').combobox({
  onBeforeLoad:function(param){
    if (param.q && param.q.length<2){return false}
  }
});