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

Unpinned column not shown

3 Answers 79 Views
VirtualGrid
This is a migrated thread and some comments may be shown as answers.
Amand
Top achievements
Rank 1
Amand asked on 15 Dec 2016, 01:33 PM

Hello,

 

I'm facing a pretty strange behavior when unpinning a column in a RadVirtualGrid:

1. Pin (left or right) 1st column
2. Scroll horizontally (to not display 2nd column)
3. Unpin 1st column
4. Scroll horizontally to display 1st column
=> 1st column is hidden, the only way to make it visible is to resize a column or the entire window

 

It seems to be a bug and I'm trying some workaround:
- Is there a way to force refresh the grid ? (RadVirtualGrid.TableElement.SynchronizeRows is not working in this case)
- Is there an event that can be captured on column pinned state change, in order to force a refresh at this time ?

 

Regards.

 

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Dec 2016, 01:10 PM
Hello Amand,

Thank you for writing.  

I have logged it in our feedback portal and I have added a vote for it on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to use the following code snippet:

private void radVirtualGrid1_ContextMenuOpening(object sender, Telerik.WinControls.UI.VirtualGridContextMenuOpeningEventArgs e)
{
    foreach (RadItem item in e.ContextMenu.Items)
    {
        if (item.Text ==
            RadVirtualGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadVirtualGridStringId.PinMenuItem))
        {
            foreach (RadMenuItem subItem in ((RadMenuItem)item).Items)
            {
                if (subItem.Text ==
                    RadVirtualGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadVirtualGridStringId.UnpinColumnMenuItem))
                {
                    subItem.Click-=subItem_Click;
                    subItem.Click+=subItem_Click;
                }
            }
        }
    }
}
 
private void subItem_Click(object sender, EventArgs e)
{
     this.radVirtualGrid1.MasterViewInfo.SetColumnWidth(0, this.radVirtualGrid1.MasterViewInfo.GetColumnWidth(0));
}

 

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
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 16 Dec 2016, 02:54 PM

Thanks for you reply.

 

I've already tried to explicitely force column width using SetColumnWidth as you suggested, but unfortunately it did not make it.
After thinking about how events work, I realized that the ColumnWidthChange can be fired only if the width value chnages:
So I came up with the following trick:

int width = this.radVirtualGrid1.MasterViewInfo.GetColumnWidth(0);<br>this.radVirtualGrid1.MasterViewInfo.SetColumnWidth(0, width + 1);<br>this.radVirtualGrid1.MasterViewInfo.SetColumnWidth(0, width);

 

The column resize is called twice, butin the end, it works !
I'll keep this work around until this issue is solved in a next Telerik update.

 

Regards.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Dec 2016, 12:48 PM
Hello Amand, 

Thank you for writing back. 

It is important to call the MasterViewInfo. method in the right time after the column has already been unpinned. That is why the suggested workaround performs this code line in the Click event of the unpin column menu item. Feel free to use this approach which suits your requirement best.

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
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
Dess | Tech Support Engineer, Principal
Telerik team
Amand
Top achievements
Rank 1
Share this question
or