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

Multi Column Header Hiding ?

1 Answer 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Venkata
Top achievements
Rank 1
Venkata asked on 31 Jul 2013, 06:17 AM
Hello,

I have tried and got success in hiding individual columns in Grid. But, my requirement is i want to hide multiple column header section also.



I want to hide "Product Details" Section also.

JS:
function ShowColumnHeaderMenu(ev, columnName) {
                var grid = $find("<%=RadGrid1.ClientID %>");
                var columns = grid.get_masterTableView().get_columns();
                for (var i = 0; i < columns.length; i++) {
                    if (columns[i].get_uniqueName() == columnName) {
                        columns[i].showHeaderMenu(ev, 75, 20);
                    }
                }
            }

Can you give me suggestions how can i do this.

Thanks in advance,
Venkata.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 02 Aug 2013, 04:35 PM
Hello,

 The latest version of RadControl supports hiding individual columns through the header context menu as shown in this online demo. So there's no need of custom code here.
However hiding header sections containing multiple columns is not supported out of the box. You can try to achieve this feature with some custom client-side code and modification but implementation won't be trivial. First you will have to add more options to the header context menu as shown in this help topic.
Then once you choose a multicolumn header section in the menu (e.g. Product Details). You will need to find all of its three child columns (Product Name, Quantity and Price) and hide them one by one using the client-side hideColumn method of the MasterTableView this will also hide the Product Details header. The show operation will require the reverse logic to show back all the hidden columns.
Again the traversing of the different headers on the client is not a trivial task and may require some more complex javascript code in order to correctly implement the show / hide operation in all cases.

Regards,
Marin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
General Discussions
Asked by
Venkata
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or