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

Filter grid using javascript

1 Answer 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cliff Gibson
Top achievements
Rank 1
Cliff Gibson asked on 16 Mar 2011, 02:20 PM
I've got a RadGrid on a page that I would like to be able to filter with a series of RadButtons which are on the same page.

I've tried using this...
var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
masterTable.filter("OrderID", 10254, Telerik.Web.UI.GridFilterFunction.EqualTo, true);
...in JS but nothing happens, the event is being fired.  I've also set the allowfiltering to be true on the grid and mastertable but this makes no difference.

Is there something I'm missing to get this to work?

Cheers
Cliff

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Mar 2011, 11:11 AM
Hello Cliff,

Try canceling the postback of the RadButton.
clientside:
function OnClientClicking(sender, args)
  {
      var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
      masterTable.filter("OrderID", "10254", Telerik.Web.UI.GridFilterFunction.EqualTo, true);
      args.set_cancel(true);//canceling postback
  }

I am not sure about the way that you are using to bind the Grid. If its simpleDataBinding then filtering won't work.If that is the case I recommend you to use  "AdvancedData binding" using NeedDataSource event.

For more information about this can be available here.
Advanced Data-binding (using NeedDataSource event)

Thanks,
Shinu.
Tags
Grid
Asked by
Cliff Gibson
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or