I'm fairly new to Kendo UI/Angular and I've run into a problem which I hope is not a biggie.Basically I want to allow users to dynamically create a grid.. that means setting data source, selecting columns.. grid options etc.The data source (which is SharePoint but it ain't part of the issue...) can sometime bring a "user" field which is the id of the user rather than the name. So after doing a little bit of research I opted to use column template function to get the actual name.Below is a portion of the Column object function that I use to dynamically create columns which will be pushed into an array.The piece of code that sets template works like a charm. However, if the grid has grouping enabled, when this column is dragged to be grouped by, then it shows the id. So I thought - too easy, I'm just going to do the same thing for the groupHeaderTemplate.. but it didn't work :( .It appears that this portion of the code * dataItem." + userId + " * is not valid when grouping. It just sends an undefined to the function. I've tried different things.. like use 'value', which kendo uses in some of their examples.. but no party so far.
Any help would be greatly appreciated!
function Column(Field, Title, Type) {
if(Type == "User"){
var userId = Field + "Id";
this.field = userId
this.template = "<span ng-bind=getUserName(dataItem." + userId + ")></span>";
this.groupHeaderTemplate = "<span ng-bind=getUserName(Dont Know What to put here)></span>";
} .....
}
Any help would be greatly appreciated!
function Column(Field, Title, Type) {
if(Type == "User"){
var userId = Field + "Id";
this.field = userId
this.template = "<span ng-bind=getUserName(dataItem." + userId + ")></span>";
this.groupHeaderTemplate = "<span ng-bind=getUserName(Dont Know What to put here)></span>";
} .....
}
Btw. when debugging this thing, I noticed that the getUSerName function gets call an stupid amounts times when rendering the grid. Is this normal? or am I doing something wrong? I'm a bit concern about the impact it could have on the performance. I mean, my test data source had 3 results, but the function was being called like 15 times.. odd.