Hi,
I have 10 records bound to a webdropdown for which I have enabled the EnableAutoFiltering="Client" and the filtering is working fine. When a user searches for a an item which is not available in the dropdown list, it shows empty (0 records and dropdown container becomes empty). Now when the user leaves the dropdown, I would like to reset the dropdown items to its original (10 items).
How can I reset the filtered result of a webdropdown?
Hello Nagraj,Thank you for posting in our forums!I have done some research on this and found that in the webdropdown you are using property EnableAutoFiltering="Client". When you set Auto Filtering client side the filtering is performed only on the client-side items collection contents, with no postbacks taking place. To reset the Dropdown you can use public method clearFilter , it clears the applied filter programmatically.function clearFilter() var resultVar = instanceOfWebDropDown.clearFilter();You can refer the following API link:http://help.infragistics.com/doc/ASPNET/2015.2/CLR4.0/?page=WebDropDown~Infragistics.Web.UI.WebDropDown~clearFilter.htmlPlease let me know if I may be of further assistance.
Hi Divya Jain,
Thanks for the response.
But I'm afraid I do not have the clearfilter method in the version 14.1.
Is there any way I can do this in 14.1?. Infragistics gives some unknown errors in the existing codes if we do any upgrades.
Hello Nagraj,
Please find the attached sample project to find the desired behavior.
When you set Auto Filtering client side the filtering is performed only on the client-side items collection contents, with no postbacks so to reset the Dropdown you can use ClientEvents method, it clears the applied filter.
function clearFilter(sender, eventArgs)
{
var DropDown = $find("<%= WebDropDown1.ClientID %>");
DropDown.set_currentValue("", true);
DropDown.filter();
}
It works well as a clear filter. But it opens the dropdown again after clearing the filter.
I have placed your code in the "DropDownOpening" event, so that I intended to clear the dropdown filter. But after clearing the filter, it opens the dropdown and again the same filtering code gets executed as I have them in the DropDownOpening event. So it just looping around. I don't wanna put any flag to workaround this.
How can I stop the dropdown from opening again after filtering.