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

Hiding columns with a size of 0 leads to weird display

4 Answers 197 Views
VirtualGrid
This is a migrated thread and some comments may be shown as answers.
Amand
Top achievements
Rank 1
Amand asked on 23 Dec 2016, 09:10 AM

Hello,

I am trying to implement a hide/show option on column. For now, I implemented a contextual menu option to do it and as a workaround I set column size to 0 to hide it but it leads to weird display (cf attached image (with 10 hidden columns)). Do you know a better workaround to avoid this display ?

 

Regards,

Amand

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Dec 2016, 01:17 PM
Hello Amand,

Hiding columns is not supported in RadVirtualGrid. To change the number of the displayed columns you just need to set the ColumnCount property. This way you would not need to load the data for the unnecessary columns as well. I have attached a small example that shows how you can achieve this. 

I hope this information is useful. Let me know if you need further assistance.

Regards,
Dimitar
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
Amand
Top achievements
Rank 1
answered on 23 Dec 2016, 02:36 PM

Hello,

Thank you for your answer, I did the same for my grid but I still have problem with custom columns which are not placed at the right place even if I unregister and register with right index. Do you know how to do ?

 

Regards,

Amand

0
Dimitar
Telerik team
answered on 26 Dec 2016, 09:18 AM
Hello Amand,

Thank you for writing back.

I can confirm that once added the custom column cannot be removed from the grid. I have logged the issue in our Feedback Portal. I have added a vote for it on your behalf as well. You can track its progress, subscribe for status changes and add your comment to it here. I have also updated your Telerik Points.

Unfortunately due to the nature of the issue I cannot provide you with a workaround for it.

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
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
Hristo
Telerik team
answered on 28 Dec 2016, 02:44 PM
Hello Amand,

I would like to follow back with some additional information about the discussed scenario.

It appears that the issue is related to the UnregisterCustomColumn method. It can be worked around by manually accessing the CustomColumns collection. In order to immediately reflect the changes in the grid, you would also need to trigger an updated of the virtualized rows container: 
this.radVirtualGrid1.MasterViewInfo.CustomColumns.RemoveAt(0);
this.visibleColumns.Remove(e.Item.Text);
foreach (VirtualGridRowElement rowElement in
    this.radVirtualGrid1.VirtualGridElement.TableElement.GetDescendants(delegate(RadElement x) { return x is VirtualGridRowElement; }, TreeTraversalMode.BreadthFirst))
{
    rowElement.CellContainer.Children.Clear();
}

I am also sending you attached a project implementing the suggested approach.

I hope this helps. Please let me know if you need further assistance.

Regards,
Hristo
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.
Tags
VirtualGrid
Asked by
Amand
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Amand
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or