I have an object in my grid schema and column definition. Upon load i set the grouping on on the Name field of my Category object. I also hide these columns since the grid doesnt appear to know to not show them when I do this.
Category: { defaultValue: {Id:null, Name:null}}, {field:"Category", title:"Category",editor: CategoryDropDownTreeEditor, template : "#= Category.Name #", hideOnGroup: true}, var g = $("#assetGrid").data("kendoGrid"); g.dataSource.group( [{ field: "AssetId" }, { field: "Category.Name" } ]); g.hideColumn("AssetId"); g.hideColumn("Category");
Here is my editor template if needed:
function CategoryDropDownTreeEditor(container, options){
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownTree({
dataTextField: "Name",
dataValueField: "Id",
autoBind:false,
filter: "contains",
height: 400,
width:750,
select: function(e) {
if(e.sender.dataItem(e.node).hasChildren){
e.preventDefault();
}
}
});
$.ajax({
url: "/Categories" ,
dataType: "json",
type:"GET",
contentType: "application/json",
data:{
MainCategoryId:options.model.MainCategoryId
},
success: function(result) {
$('input[name="Category"]').getKendoDropDownTree().dataSource.data(processTable(result, "id", "parent", 0));
},
error: function(result) {
console.log("fail");
}
});
}
When I hit edit on my record the value disappears on the grouping header:
and if i hit cancel the value doesnt come back:
Hello, Bryan,
Thank you for the provided details.
I set up a small Dojo example where I attempted to reproduce the issue with the disappearing values, however I couldn't get it to break in the same manner.
https://dojo.telerik.com/@gdenchev/OWAvEnEb
Generally speaking, we recommend that flat values are used instead of complex objects, especially when the Grid has enabled features such as grouping, editing, filtering, sorting, etc.
With all of that said, could you try using a groupHeaderTemplate to manually render the group text and see if that makes a difference?
If not, could you please try to reproduce the issue in the Dojo and then send it back to me? I should be able to provide you with some additional suggestions if I can debug the problem on my end.
Best Regards,
Georgi
Thanks Georgi. I was able to resolve the issue by adding a new field as such: