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

mvc grid dynamic binding refresh with different datatables

3 Answers 322 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zhuang
Top achievements
Rank 1
Zhuang asked on 06 Mar 2015, 02:05 PM
Hi,

I have a mvc grid binding to data table.

On web page, I have a dropdownlist, when user select different item, I make a ajax call which returns a different datatable with different columns.

On ajax success, I do

$('#GridName').data('kendoGrid').dataSource.data(data);
$('#GridName').data('kendoGrid').refresh();

Which normally work if grid is binding to a model, but not this time for dynamic binding

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Mar 2015, 12:57 PM
Hello,

Try using the setOptions method of the grid instead. It will allow you to change the current columns.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
cheng
Top achievements
Rank 1
answered on 22 Aug 2016, 12:06 AM

Hi there,

I am having the same issue. Please could you tell me if you have resolved your issue. If you did, please show me how you do it.

I have no idea about using setoptions? Also, the link suggested by support was not very clear to me.

Please assist me.

0
Boyan Dimitrov
Telerik team
answered on 24 Aug 2016, 07:28 AM

Hello cheng,

When the Kendo UI Grid is initialized with a specific set of columns (specific columns definition) it does not allows columns to be changed without destroying and initializing the Kendo UI Grid with the new set of columns. The easiest way to do that is by using setOptions method - this method does that internally. 

Regards,
Boyan Dimitrov
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Grid
Asked by
Zhuang
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
cheng
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or