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

Grid.Column.title

1 Answer 760 Views
Grid
This is a migrated thread and some comments may be shown as answers.
shazi
Top achievements
Rank 2
shazi asked on 08 Nov 2018, 10:30 AM

 columns.Bound("").HeaderTemplate("#=getTitleforAllownceColumn(data)#").ClientTemplate("#=getTemplateForAllownceColumn(data)#");
columns.Bound("").Title("#=getTitleforDeductionColumn(data)#") or .HeaderTemplate("#=getTitleforDeductionColumn(data)#").ClientTemplate("#=getTemplateForDeductionColumn(data)#");

 

I want to set title dynamically through a java script method so that i can iterate through a list of items that i don't have idea how many members will be inside the list and what will be their value and description.

ClientTemplate is hitting the method but title and headertemplate do not

Is there any way i can achieve this.

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 12 Nov 2018, 07:39 AM
Hi Shazli,

If you want to generate a dynamic list of columns, you can consider the approach shown in this example:
Bind the Grid to DataTable

There is also a client-side approach that generates the Grid columns and model on the fly based on a JSON response from a service:
Create Grids with Dynamic Columns and Data Types

Binding the header template and title using client template expressions will not work because the columns are created in the Grid before the data is actually available and these specific templates do not have a data context to take values from.

Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
shazi
Top achievements
Rank 2
Answers by
Tsvetina
Telerik team
Share this question
or