EasyUI Forum
April 29, 2024, 01:38:14 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to load easyui-combobox data after typing 1-2 symbols  (Read 8778 times)
volodias
Newbie
*
Posts: 8


View Profile
« 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.
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #1 on: September 17, 2013, 01:12:13 AM »

Hi,

Just check size in PHP and 'die' if it is too small
Logged
volodias
Newbie
*
Posts: 8


View Profile
« Reply #2 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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}
  }
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!