RadGrid filtering from javascript

1 Answer 130 Views
Grid
Milo
Top achievements
Rank 1
Milo asked on 21 Sep 2021, 01:54 AM

Hello!

We have a radgrid (<telerik:RadGrid) structure defined on the aspx page, which also consist of the grouping column definition. This loads up fine binding with the data and grouping correctly loaded.

We have a left pane which has a radtreeview (<telerik:RadTreeView) to filter the grid. For this, we have a JavaScript Ajax get call to the api controller and we bind the response to the grid, the data is loaded correctly with the correct number of rows, but the grid doesn’t maintain the grouping. Any specific reasons, anything we can do to make this work?

The only difference between the initial load is that the same API is called from the codebehind file, and the filter from the treeview is called from javascript ajax get call and I am binding the grid using databind() as below.

 var grid = $find($(".RadGrid").attr("id")).get_masterTableView();
grid.set_dataSource(result);
grid.clearSelectedItems();
grid.dataBind();

Thank you.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 23 Sep 2021, 04:10 PM

Hello Milo,

When it comes to data binding, it is very important that you use more advanced Data Binding instead of the simple technique ( DataSource + DataBind() ). 

Simple data binding can only display items, but if you need functionalities such as filtering, paging, grouping, etc.. you will need to bind the Grid to RadClientDataSource. We have an online example that you can check and test, see Grouping Client-Side with RadClientDataSource

Check out the Service Configuration to see examples of configuring the ClientDataSource.

Here are two examples of RadGrid CRUD (created, read, update, delete) operations using RadClientDataSource and two different WebServices.

 

The same is true if you're binding data on the server-side. DataSource + DataBind() combination is only for displaying data and It's not compatible with Filtering, Grouping, etc.

I hope this will help resolve the issue.

Regards,
Attila Antal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Milo
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or