Unpinned column not shown

4 posts, 0 answers
  1. Amand
    Amand avatar
    23 posts
    Member since:
    Aug 2012

    Posted 15 Dec 2016 Link to this post

    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.

     

  2. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 16 Dec 2016 Link to this post

    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.
  3. Amand
    Amand avatar
    23 posts
    Member since:
    Aug 2012

    Posted 16 Dec 2016 in reply to Dess Link to this post

    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.

  4. Dess
    Admin
    Dess avatar
    2110 posts

    Posted 19 Dec 2016 Link to this post

    Hello Amand, 

    Thank you for writing back. 

    It is important to call the MasterViewInfo.SetColumnWidth 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.
Back to Top