javascript - How can I send a value from a column in a Kendo Grid containing a button to a ClientTemplate? -
i trying send id row in grid clienttemplate. have column delete button , want send id of row clicked on clienttemplate can hit controller ajax call. know can via "url.action("action","controller")" attempting without page refreshing since grid dealing child view located within kendo popup window. have tried several variations of syntax no avail. in helping solve matter , appreciated. below of syntax have tried.....
column .template(@<text></text>).width(90) .clienttemplate("#= mydeletetemplate(csvsubmittalid) #"); .clienttemplate("<div style='text-align:center'><a class=actionbuttondelete href=\"" + url.action("deletecsvrow", "project") + "/#=csvsubmittalid#\"> [delete] </a></div>"); .clienttemplate("#= mydeletetemplate(csvsubmittalid)#", <div style='text-align:center'><a class=actionbuttondelete [delete] </a></div>"); i need button in column yet pass id of row javascript without use of url.action
the below works me using similar functionality. issue call via $.ajax{}
....
.clienttemplate("<a style='' id='lnkdelete#=csvsubmittalid#' onclick='lnkdeleteonclick(#=csvsubmittalid#)' href='javascript:void(0)'><strong>${firstname}, ${lastname}</strong</a>") ...
function lnkdeleteonclick(csvsubmittalid){ $.ajax({ type: "get", url: '@url.action("deletecsvrow","project")', datatype: "json", traditional: true, data: {csvsubmittalid:csvsubmittalid}, success: function (data, status, xhr ) { var grid = $("#mygrid").data("kendogrid"); grid.datasource.read(); }, error: function (xhr, status, error) { console.log(error); } }); }
Comments
Post a Comment