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

Hide columns in a grid // table ID attribute of the grid.

3 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 23 Dec 2013, 12:20 AM
I have 2 questions...

1) On responsive pages, how do I make the grid columns hide based upon screen size?

2) How do give an id attribute to the table when it is created?   I know the grid is generated within a div tag holder which I can reference.   I only want to reference the table ID (i.e. the grid itself).

Thanks.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 23 Dec 2013, 08:29 AM
Hello Bob,

When you need to hide a column (when your re-sizing logic kicks in) you can use the hideColumn/showColumn methods of the Grid.

You can get reference to the table element via the table field of the object of the Grid.

e.g.

var gridTable = $('#gridName').data('kendoGrid').table;


Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bob
Top achievements
Rank 1
answered on 24 Dec 2013, 01:20 AM
Thanks... I got the hideColumn to work.   However, invoking the showColumn method on the column does not place the data back into the grid.   It does place the columns, but you must refresh the datasource... Is this this expected behavior?

On the showColumn method, the column formatting (width, etc...) is gone from the initialization of the grid.    Is there a way to reformat the columns of the grid without rebuilding it (i.e. as you would to create it)?

Thanks.
0
Petur Subev
Telerik team
answered on 24 Dec 2013, 09:19 AM
Hello Bob,

What do you mean that the data is gone? I am not able to reproduce such behavior, when I hide/show a column it's size is persisted. Check the following JsBin I prepared:

http://jsbin.com/igUSoCOL/3/edit

Let me know if I missed something.

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