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

RadGrid: Clear filter at client - side.

11 Answers 846 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abhijit Shetty
Top achievements
Rank 2
Abhijit Shetty asked on 17 Oct 2012, 06:33 PM
Hi Team,

I need to clear RadGrid at client - side.
I tried this: masterTableView.get_filterExpressions().clear(); which cleared array holding filterExpressions but my filter values were preserved in filter textbox!

11 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 22 Oct 2012, 01:49 PM
Hello Abhijit,

Just use the following code:

function clearFilter()
{
    var grid = $find("<%= RadGrid1%>")
    var tableView = grid.get_masterTableView();
    tableView.getColumnByUniqueName("ProductID").set_filterFunction(0);
    tableView.get_filterExpressions().clear();
     
    var filterRow = $telerik.$(grid.get_element()).find(".rgFilterRow");
     
    //ProductID is the name of the column in my case; just substitute it with your own.
    var txtProductID = $telerik.findElement(filterRow[0], "ProductID")
 
    txtProductID.value = "";
 
    tableView.rebind();
}


Hope it helps.


Regards, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Abhijit Shetty
Top achievements
Rank 2
answered on 23 Oct 2012, 03:29 AM
Thanks Tsvetoslav,
After posting it in forum and doing some RND i found a link to modify FilterExpression at client - side as:
http://www.telerik.com/help/aspnet-ajax/grid-client-side-binding-adding-sort-filter-expressions.html
So according to you which is best and feasible option to do the same.
0
Accepted
Tsvetoslav
Telerik team
answered on 23 Oct 2012, 11:57 AM
Hello Abhijit,

Well, do go with the help topic approach - it is more concise and uses an out-of-the-box api that I missed.


All the best, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Subodh
Top achievements
Rank 1
answered on 13 Jul 2013, 08:34 AM
Hello Telerik Team,

                              I need to clear Rad grid  filter without doing post back at client side, I was try masterTableView.get_filterExpressions().clear(); but it is not working, I was also try masterTableView.clearSort() but it do post back. I have to clear rad grid filter without post back. How can i do  this, please provide your answer.
0
Tsvetoslav
Telerik team
answered on 17 Jul 2013, 11:33 AM
Hi Abhijiit,

If you are binding the grid on the server, you can't circumvent the post-back - as it is needed to bring the new unfiltered data. If you are binding the grid client-side, just use:

masterTableView.get_filterExpressions().clear();
masterTableView.rebind()

Hope it helps.
 
Regards,
Tsvetoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Subodh
Top achievements
Rank 1
answered on 22 Jul 2013, 07:31 AM
Hello Tsvetoslav,

                             I am binding my grid at client side, but i am closing my popup from client side on that close button i have to reset filter of rad grid, I was try masterTableView.get_filterExpressions().clear(); but it is not working. Without doing postback i have to clear filter in client side. If i use masterTableView.clearSort() it do postback. How can i resolve this problem?
0
Tsvetoslav
Telerik team
answered on 24 Jul 2013, 01:21 PM
Hello Subodh,

Try reproducing the issue on the attached sample and send it back.
 
Regards,
Tsvetoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Subodh
Top achievements
Rank 1
answered on 28 Nov 2013, 09:36 AM
Hello Telerik Team,

We have to set Current Page index of rad grid to 0 on client side only. We have tried with set_CurrentPageIndex on client side
for Rad Grid. but it was not working to set current page index giving an error.


We have to set current page index without doing post back.


Waiting for reply.



Thanks,
Subodh
0
Radoslav
Telerik team
answered on 03 Dec 2013, 07:13 AM
Hello Subodh,

To achieve the desired functionality you can try using the MasterTableView. set_currentPageIndex() function:
function resetPager()
{
      var masterTableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
      masterTableView.set_currentPageIndex(0, false);
}

Also I am sending you a simple example which demonstrates it. Please check it out and let me know if it helps you.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Kishan
Top achievements
Rank 1
answered on 10 Apr 2015, 09:35 AM

Hi Team, 

             Clear all Telerik:RadGrid filter column  not working at client side using following code. Is there any Radajax control effect to                clear filter column? because I use RadAjaxPanel in this page

             var masterTableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
             masterTableView.get_filterExpressions().clear();
             masterTableView.rebind();

 

Thanks & Regards

Kishan Prajapati

 

0
Radoslav
Telerik team
answered on 14 Apr 2015, 08:08 AM
Hello Kishan,

The posted code snippet works, however you need to clear the filter controls' values manually. I am sending you a simple example which demonstrates this. Please check it out and let me know if it helps you.

Looking forward for your reply.

Regards,
Radoslav
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Abhijit Shetty
Top achievements
Rank 2
Answers by
Tsvetoslav
Telerik team
Abhijit Shetty
Top achievements
Rank 2
Subodh
Top achievements
Rank 1
Radoslav
Telerik team
Kishan
Top achievements
Rank 1
Share this question
or