EasyUI Forum
April 25, 2024, 07:39:12 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Bug in combobox with filter and onShowPanel  (Read 5244 times)
peter
Newbie
*
Posts: 10


View Profile
« on: October 29, 2017, 02:03:55 AM »

I have set up a combobox as shown below.
The first time that the user presses a key in the combobox the following events happen:
 1. The filter is run on the current data in the combo box
 2. Once that is finished, the onShowPanel code is run. In this case it is a reload.
 3. The filter is NOT run on the reloaded data.

Shouldn't the filter be run on the reloaded data?

Peter



$(id).combobox({ 
   url:        url, 
   method:     'post',
   mode:       'local',
   valueField: valueField, 
   textField:  textField,
   editable:   true,
   required:   true,
   filter: function(query,row) {
       var opts = $(this).combobox('options');
       var valueInDropdown = row[opts.textField] ;
       return myTest(query, valueInDropdown) ;
   },
   onShowPanel: function() {
       $(id).combobox('reload') ;
   }
}) ;
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 29, 2017, 08:36:29 PM »

The 'reload' method reloads data from remote server. It does not trigger the 'filter' action. You should call the code below to filter data.
Code:
var q = 'filter value...';
var cc = $('#cc');
cc.combobox('options').keyHandler.query.call(cc[0], q);

You can also override the 'query' function to custom your filter logic.
Code:
$('#cc').combobox({
mode: 'local',
keyHandler: $.extend({}, $.fn.combobox.defaults.keyHandler, {
query: function(q, e){
//...
}
})
})
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!