jquery - changing coloum data in kendo grid conditionaly -
i trying change value of colums in kendo grid conditionaly. grid id binded data needs modifications in data binded.
i have used couple of sample codes got stackoverflow none of them reflecting. there no change in grid data
1st way
var grid = $("#grid").data("kendogrid"); var items = grid.datasource.data(); (var = 0; < items.length; i++) { items[i]["matchcount"] = "4"; }
2nd way tried
var dataitem = $("#grid").data("kendogrid").datasource.data()[0]; dataitem.set("matchcount", "ccc");
3rd way
var dataitem = $("#grid").data("kendogrid").datasource.data()[0]; dataitem.set("matchcount", "50");
the way grid binded below:
$("#grid").kendogrid({ datasource: datasource, columns: [ { field: "rowid", title: "rowid", hidden: true }, { field: "lastname", title: "last name", width: 150, editable: false, headertemplate: createheadertemplate("last name") }, { field: "matchcount", width: 120, editable: false, template: "#if(matchcount == 0){#<span>#=matchcount#</span>#}else{#<a href='javascript:void(0)' onclick='showmatches("#=lastname#","#=firstname#",${matchcount},"#=matchids#");' style='margin-left:50px' >#=matchcount#</a>#}#" } ], edit: function (e) { //e.container.find("input[name='name']").each(function () { $(this).attr("disabled", "disabled") }); }, editable: false });
you're doing ok in attempts 2 , 3. perhaps need run refresh()
method:
dataitem.set("matchcount", "50"); grid.refresh();
Comments
Post a Comment