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

How to customize column and load list property

1 Answer 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ping
Top achievements
Rank 1
Ping asked on 16 Dec 2020, 09:33 AM

Hi,

I have a model like below:

class Foo{

   public int id {get; set;}

   public string name {get; set;}

   public List<int> values {get; set;}

}

I would like to display the model with telerik grid as follow:

Id        Name       Jan-21    Feb-21   Mar-21

1          name1     10            20         30

2          name2     20            30         40

 

The Id is mapped to Foo.Id; Name is mapped to Foo.Name; Jan-21, Feb-21, Mar-21 are dynamic generated(in the future it will change) and the value is from the Foo.values.

 

I checked all the columns' example, telerik seems doesn't support such scenario. The model's field is supposed to be static and not supports List property.

 

Does anyone have a good idea to accomplish the feature? Many thanks in advance.

 

Best regards,

Ping

   

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 18 Dec 2020, 09:10 AM

Hello Ping,

The approach of having a grid bound to a nested model is by using the syntax .Grid(Model.values). However, this is considered server binding and the fact that you have set the data source for Ajax makes a mismatch between the two. If you would like to have the server-bound grid, set the ServerOperation() property to false. 

Below I am posting a link to a forum thread discussing the same topic.

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Ping
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or