This is a migrated thread and some comments may be shown as answers.

Remove filter when FilterDelay is set

6 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
marina
Top achievements
Rank 1
marina asked on 24 May 2011, 12:15 PM
Hello,
I have a gridboundcolumn with attribute FilerDelay set to 1. The filter works correctly, after 1 second the autopostback is done and the filter command is "EqualTo".  The problem is that if I wish to remove the filter by selecting from the filter list the "NoFilter" voice, on ItemCommand method, the argument of the command remains "EqualTo" instead of "NoFilter". So I can't remove the filter set before.  Every other choises(GreaterThen, Less.....etc) apart from "NoFilter" work correctly and are 'recognised' inside the ItemCommand method.
Could you please help me with this problem?
Thank you very much.
Marina

6 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 27 May 2011, 07:23 AM
Hi marina,

When you have set FilterDelay and AutoPostBackOnFilter="true", clearing the filter is done by deleting the text in the filter textbox. Otherwise, if RadGrid determines the filter textbox contains a value other than empty string, it applies the default filter ("EqualTo" in your case), no matter the filter option you have chosen from the menu. To work around this scenario and have the NoFilter menu option to clear the current applied filter for this column, you can attach to the filter menu OnClientItemClicking event:

<telerik:RadGrid>
        <FilterMenu OnClientItemClicking="clientItemClicking"></FilterMenu>
</telerik:RadGrid>

and use the following javascript:

function clientItemClicking(sender, args)
{
    if(args.get_item().get_value() === "NoFilter")
    {
        var target = args.get_targetElement();
        var filterBox = target.parentNode.getElementsByTagName("input")[0];
        filterBox.value = "";
    }
}

The above script clears the value of the filter textbox for the column in which the context menu was opened.

Greetings,
Veli
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Cristian
Top achievements
Rank 1
answered on 10 Aug 2011, 06:38 PM
Hi I'm I little bit confused you said that when FilterDelay and AutoPostBackOnFilter="true", are set  clearing the filter is done by deleting the text in the filter textbox, this means that when I erase the text a postback comes like when I write something in the textbox?
Because I have this situation, if I wtrite some text in the filter textbox the grid is filtered correctly after the filter delay, but if I erase the text I have to hit enter to "erase " the filter, is it possible to do it automatically without hitting enter after clearing textbox?
0
Veli
Telerik team
answered on 12 Aug 2011, 02:39 PM
Hi Cristian José,

The automatic filtering occurs when the filter input's onchange event fires. The onchange event of an HTML input element fires when the input value is changed and the control loses focus, i.e. is blurred. In your scenario, you need to either press Tab after deleting the text from the input, or click somewhere else with the mouse. Both actions blur the filter input and cause the grid to automatically fire the filter command.

Greetings,
Veli
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Martin
Top achievements
Rank 1
answered on 20 Apr 2016, 12:29 PM

I have the same problem - AutoPostBackOnFilter="true" and now setting the NoFilter is not working anymore (the CurrentFilterValue is autmatically is set)

I use the ItemCommand event receiver to get the filters that are set.

How can I set the CurrentFilterValue to NoFilter or make shure that this value is not changed to the default value when NoFilter is clicked?

->Version 2015.2.623.35, in SharePoint 2010 and therefore document mode od IE8.<-

0
Martin
Top achievements
Rank 1
answered on 20 Apr 2016, 12:48 PM
...my mistake - it happens when I enable the filter delay function, it work's fine when I enable the autopostback for filtering.
0
Maria Ilieva
Telerik team
answered on 25 Apr 2016, 08:58 AM
Hello Martin,

I would suggest you to upgrade your application to the latest official release of the controls and see if the issue still appear. Also if the problem still exists i would suggest you to open separate thread,as the current one is rather old and in a new thread it will be easier for us to track the issue in your specific scenario.

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
marina
Top achievements
Rank 1
Answers by
Veli
Telerik team
Cristian
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or