Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
InitializeLayout being fired when Datasource is changed.
posted

Hi,

I have ultragrid and its layout is being defined in InitializeLayout event. (Visible columns/Column Width/ColumnOrder etc.). Its datasource is set to Datatable. I have a refresh button which causes Datatable to reloaded and is bind to grid. The operations I can perform on grid at runtime: 1) Hide/Unhide columns using ColumnChooser. 2) Change Column width. 3) Change columns order. So after doing above operations and then clicking Refresh button, grid's source is refreshed and thus above changes to Grid UI are lost as grid's InitializeLayout is called. Can anyone help me in this regard ?

Probable solution I will be implementing: Maintaining Grid's layout in the form of xml in cache, and whenever there is change in Grid's property,(PropertyChange Event) will update that xml object. And thus if datasource is changed, grid's layout will be set from xml object in InitializeLayout event.

The problem with above solution is that PropertyChange event fires many times. So updating xml cache object will affect performance.

Please suggest any alternative solution.

Regards,

Karan   

Parents
No Data
Reply
  • 685
    Suggested Answer
    posted

    You could call Clear() on the grid DataTable, then Merge() the new data into it.

    This should not reset the grid layout.

Children
No Data