EasyUI Forum
May 06, 2024, 12:53:57 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: DataGrid Filter Row Needs Fix  (Read 2487 times)
poeziafree
Jr. Member
**
Posts: 69


View Profile Email
« on: April 12, 2022, 12:46:04 PM »

Hello

I am using the combobox in DataGrid Filter Row.

See the code:

Code:
{
                                    field: 'type',
                                    type: 'combobox',
                                    limitToList: true,
                                    options: {
                                        panelHeight: 'auto',
                                        data: [{
                                            value: '0',
                                            text: '-'
                                        }, {
                                            value: '1',
                                            text: 'შეკვეთა'
                                        }, {
                                            value: '2',
                                            text: 'ჯარიმა'
                                        }, {
                                            value: '3',
                                            text: 'ხელფასი'
                                        }, {
                                            value: '4',
                                            text: 'ბონუსი'
                                        }, {
                                            value: '5',
                                            text: 'კორექცია'
                                        }],
                                        valueField: 'value',
                                 textField: 'text',
                                 onChange: function(newValue, oldValue){
                                 if (newValue == '') {
                                                dg.datagrid('removeFilterRule', 'type');
                                            } else {
                                                dg.datagrid('addFilterRule', {
                                                    field: 'type',
                                                    op: 'equal',
                                                    value: newValue
                                                });
                                            }
                                            dg.datagrid('doFilter');
                                 }
                                        
                                    }
                                },


When I use keyboards to navigate through combobox items with keyboard to select an item, the DataGrid Filter sends double request to the server, firstly the value of the item and then the text of the item.

What can I do to fix this?

I think, the request to the server should only be made when either an item is selected from the combobox or when the typed text matches one of the items' text from the combobox.


Thank you in advance!
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: April 12, 2022, 11:50:26 PM »

Please try to set the 'selectOnNavigation' property to false.
Code:
options: {
    panelHeight: 'auto',
    selectOnNavigation: false,
    data: ...
}
Logged
poeziafree
Jr. Member
**
Posts: 69


View Profile Email
« Reply #2 on: April 12, 2022, 11:52:52 PM »

Hello,

I did also try this, but then, pressing ENTER causes the same thing, firstly, it sends the numeric value to the server and then the text value is sent to the server.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: April 13, 2022, 09:23:58 PM »

Please try to set the 'trigger' to 'none', make sure to download the newest 'datagrid-filter.js' file from https://www.jeasyui.com/extension/datagrid_filter.php.
Code:
{
    field:'type',
    type:'combobox',
    trigger: 'none',
    options: {
   panelHeight: 'auto',
   selectOnNavigation: false,
   data: ...
    }
}
« Last Edit: April 14, 2022, 04:22:38 PM by jarry » Logged
poeziafree
Jr. Member
**
Posts: 69


View Profile Email
« Reply #4 on: April 14, 2022, 11:14:18 AM »

Hello Jarry

Unfortunately it didn't fix the bug, it still sends double requests to the server.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: April 14, 2022, 04:24:24 PM »

The 'trigger' should be added to the filter options instead of combobox options. This example works fine.
https://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=material-teal&dir=ltr&pitem=Remote%20Filtering%20on%20DataGrid&sort=asc
Logged
poeziafree
Jr. Member
**
Posts: 69


View Profile Email
« Reply #6 on: April 14, 2022, 11:04:03 PM »

Thanks

It fixed the issue.
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!