EasyUI Forum
November 05, 2025, 08:56:21 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: Clear datagrid filter [Solved]  (Read 10994 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: June 03, 2015, 05:02:26 AM »

I have a datagrid with filter row inside a dialog box, it works great the first time it is opened, I can key text into the filter row and the record is selected and I close the dialog.

But when I re-open the dialog, I want to clear the previous text and clear the filter but I am unable to do that.

I can clear the values, but it will not redisplay all of the rows and the previous filter is still applied:
Code:
  $('#_query_').dialog({
    width: 'auto',
    height:'auto',
    closed:true,
    iconCls:'icon-filter',
    modal:true,
    onOpen: function(){
      $('input.datagrid-filter').val('');
      $('input.datagrid-filter:first').focus().trigger('change');
      $('#_query_dg').datagrid('unselectAll')
      //$('#_query_dg').datagrid('removeFilterRule');
      //$('#_query_dg').datagrid('disableFilter');
      //$('#_query_dg').datagrid('enableFilter');
      //
    }
  })

I have tried enabling & disabling the filter, triggering change, bluring and focusing the field but nothing works, the only way to get the rows to display is to hit the tab key ??
« Last Edit: June 03, 2015, 08:08:34 AM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 03, 2015, 07:56:16 AM »

To clear the filter rules, please call 'removeFilterRule' method instead.
Code:
$('#dg').datagrid('removeFilterRule', field);
$('#dg').datagrid('doFilter');
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: June 03, 2015, 08:08:12 AM »

Thanks, that works
Logged

-- Licensed User --
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!