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

Hidden columns visible after reloading tab

1 Answer 83 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
klac
Top achievements
Rank 1
klac asked on 23 Jun 2017, 04:18 PM

I have a TreeList inside a RadMultiPage and using a RadTabStrip to select the pages. When the tab is first selected the TreeList loads as expected. But after clicking the tab a second time, the TreeList shows the hidden columns. I believe that it may be related to the view state not being passed to the server on post back. Ideally, i would like the OnNeedDataSource event to fire again to rebuild the TreeList but I'd still like to maintain the view state as well.

I've attached the source files as images.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
klac
Top achievements
Rank 1
answered on 28 Jun 2017, 03:53 PM

I've figured out the problem and some possible solutions. It appears that hiding columns on the server side is not fully supported. There is information stored on the client for hidden columns but this information is not initialized from the server information. Options for resolving this issue include:

1) after the tree list is created, toggle all hidden columns to be displayed, then back to being hidden:

var columns = _treeList.get_columns();
for (var i = 0; i < columns.length; ++i)
{
    var column = columns[i];
    if (column.get_display()) continue;
    column.show();
    column.hide();
}

*Note that doing this from the OnTreeListCreated event requires calling the function from a window.setTimeout as the tree list hasn't fully initialized yet.

 

2) after the tree list is created, update the internal list of hidden columns:

var columns = _treeList.get_columns();
for (var i = 0; i < columns.length; ++i)
{
    var column = columns[i];
    if (column.get_display()) continue;
    _treeList._displayColumns[column.get_uniqueName()] = false;
}
_treeList.updateClientState();

*Note that this is much faster than option 1 but has a risk of breaking in a future release.

 

Tags
TreeList
Asked by
klac
Top achievements
Rank 1
Answers by
klac
Top achievements
Rank 1
Share this question
or