EasyUI Forum
March 04, 2024, 01:38:05 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: datagrid + enableFilter  (Read 907 times)
rezzonico
Full Member
***
Posts: 182


View Profile
« on: November 09, 2023, 08:58:26 AM »

Hi,

I have a datagrid with "enableFilter". In the filter, I have a combobox with the property "multiple: true".
If you select a line in the combobox, an error is received in the console.
How can I avoid this ?

See the code here:
http://217.193.156.220/BBB/


Thanks
Miche
« Last Edit: November 09, 2023, 09:08:24 AM by rezzonico » Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: November 14, 2023, 01:32:01 AM »

Please extend a new operator to filter multiple values.
Code:
$.extend($.fn.datagrid.defaults.operators, {
    mequal: {
        text: 'Equal',
        isMatch: function (source, value) {
            const vv = value.split(',');
            const index = vv.indexOf(source);
            return index != -1;
        }
    }
})

And then apply it to your code.
Code:
onChange: function (value) {
    if (value == '') {
        dg_HW.datagrid('removeFilterRule', 'Year');
    } else {
        dg_HW.datagrid('addFilterRule', {
            field: 'Year',
            op: 'mequal',
            value: value.join(',')
        });
    }
    dg_HW.datagrid('doFilter');
}
Logged
rezzonico
Full Member
***
Posts: 182


View Profile
« Reply #2 on: November 14, 2023, 04:26:12 AM »

Thanks !

Regards
Miche
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!