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

Unhide RadGrid columns on clientside

2 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vibhor
Top achievements
Rank 1
Vibhor asked on 14 Dec 2016, 12:41 PM

I am using a RadGrid, on load some of the columns are hidden. I have a button which should unhide those columns when clicked and the text should change to Hide. On click of the same button again the columns should hide. I am able to hide the columns successfully  but unable to figure out how to unhide.

Here is the code:

<input type="button" id ="toggle" value = "Hide" onclick="HideUnhide()" class="=tdText" /></>

function HideUnhide() {

                var grid = $find("<%= RadGrid1.ClientID %>");
                    grid.get_masterTableView().hideColumn(8);
                    grid.get_masterTableView().hideColumn(9);
                    grid.get_masterTableView().hideColumn(10);
                }

I am trying to include condition in the function where I can change the text from Unhide to Hide and depending on the text Unhide the columns in the else part but that doesn't seem to work.

Currently this code can only hide unhidden columns. 

Please help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 19 Dec 2016, 09:04 AM
Hi Vibhor,

The method you are looking for is called showColumn:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/methods/showcolumn

I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Vibhor
Top achievements
Rank 1
answered on 23 Feb 2017, 06:28 AM
Thanks.
Tags
Grid
Asked by
Vibhor
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Vibhor
Top achievements
Rank 1
Share this question
or