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

How to make foreign key column switchabel?

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 31 Oct 2012, 02:28 PM
Dear fellow warriors,

I'm experimenting with the foreign key example with the aim to make the foreign key column, so that the user can toggle between the foreign key values and the foreign key texts. I couldn't find API-calls for such a thing so I tried this:

var foreignKeyGrid = $("#grid").data("kendoGrid");
delete foreignKeyGrid.columns[1].values;  //deletes the foreign key mappings from the "Category"-Column
foreignKeyGrid.refresh();

This doesn't have any effect, the grid still shows the category names instead of the category ids. Any ideas how I could achieve the desired behaviour? (next step would be to toggle back, i.e. show the category names again. Next step would be to connect all of this with a UI-Toggle-Switch)

BTW the refresh call isn't my preferred one for this problem, as it re-requests the data from the DataSource - this causes extra network traffic for remote data grids, is there an API-call for a simple client-side redraw?

Many thanks for your advice,
Thomas

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Nov 2012, 03:20 PM
Hello Thomas,

The Grid does not support changing the Column template on the fly. You could try to achieve your goal with a Template column.

On a side note calling the Grid refresh should not perform an Ajax request - the Grid should be redrawn using the local data.

All the best,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or