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

Update grid column template

1 Answer 946 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 24 Apr 2017, 08:49 PM

Hi,

How can I update a column template based on a selected option from my context menu?

So when I select a row in my grid and right click the mouse to open the context menu I would like to update the status column with the selected option from my context menu.

so far the I build this exampl: http://dojo.telerik.com/@Ricardo%20Coelho/AyeVUz/11

 

Could someone help me with thins?

Thanks.

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 26 Apr 2017, 11:30 AM
Hello Ricardo,

The desired result can be achieved using jQuery to change the content of the td element based on the selection from the context menu. Please have in mind that as these values are not part of the dataSource they will be lost if the Grid is re-rendered:

http://dojo.telerik.com/OhekO

If the values are part of the dataSource, I can suggest instead of changing the text to set a new value to the 
field:

row = $(this).closest("tr"),
grid = $("#grid").data("kendoGrid"),
dataItem = grid.dataItem(row);
dataItem.set("columnName", "newValue");

I hope this is helpful.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or