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

Functionality for dynamic number of columns?

3 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Olga
Top achievements
Rank 1
Olga asked on 09 May 2013, 12:52 AM
Hello!
I'd like like to be able to specify during runtime  what columns grid would have.  Is this functionality available in 2013 Q1?

More scenario details:
  user checks in multiselect countries he is interested in (USA, Germany, Australia) and grid is created with 3 columns for corresponding country :
                          USA     Germany   Australia
          Metric1     2              32             12
          Metric2    15             10             11
 Then user also selects Japan and it's added as column #4 to the grid


3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 10 May 2013, 11:27 AM
Hi Olga,

Columns of the Grid should be set during the initialization and cannot be changed at runtime. What I can suggest is to create all the columns and make them initially hidden (columns.hidden). 

You can hide/show the columns during runtime via showColumn/hideColumn methods.
I hope this will help.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Olga
Top achievements
Rank 1
answered on 10 May 2013, 03:55 PM
Thanks, Alexander for your reply!

Creating and hiding columns is in interesting approach, I  will note it for future.
However in case columns are Countries it may require creating 200 columns most of those will never be used -- does not seem like a very optimal use of resources...
0
Alexander Valchev
Telerik team
answered on 13 May 2013, 09:03 AM
Hi Olga,

You are correct, the solution is not optimal for that large amount of columns.
In such case you may try to destroy and re-initialize the widget with new column configurations.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Olga
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Olga
Top achievements
Rank 1
Share this question
or