EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on September 05, 2016, 02:25:47 AM



Title: enableFilter + combotree + onChange
Post by: rezzonico on September 05, 2016, 02:25:47 AM
Hi all,

I have a simple datagrid with 3 columns.
I use "enableFilter".
The second column is a combotree, the third column is a combobox.
On both columns I use the "onChange" event but only in the third column this event works correctly.

Please select the following link:
http://195.144.40.170/jeasyui/NNN/index1.html
If you type a letter in the third column in the console.log you will see a text (the onChange event fires).
But if you do the same in the second column nothing appears (the onChange event don't fire).

Thanks in advance for any help.

Regards.
Miche


Title: Re: enableFilter + combotree + onChange
Post by: jarry on September 05, 2016, 08:41:15 AM
The textbox in combotree only act as a searching box. Inputing chars does not trigger the 'onChange' event. You can override the 'query' function to trigger this 'onChange' event when no tree node is selected.
Code:
var options = {
editable: true,
onChange: function(v){
console.log('onChange:'+v)
},
keyHandler: $.extend({}, $.fn.combotree.defaults.keyHandler, {
query: function(q,e){
var target = this;
var state = $.data(target, 'combotree');
var opts = state.options;
var tree = state.tree;
state.remainText = true;
tree.tree('doFilter', opts.multiple ? q.split(opts.separator) : q);
if (!tree.tree('getSelected')){
$(target).combotree('setValue', q);
}
}
})
};