Hello
I got some questions to Load and Save WinGrid layouts, the behavior on getting over 50thousand lines of designer code when adding a bindingsource. The bindingsource look on a datasource table which has an 'inherited' parent/children relation on itself.
My first problem is the datatable in my datasource which has a recursiv character / parent/child relation. The designer file sometimes takes few minutes to load and has over 50.000 lines of code an nearly a thousand band inherited. I tried the property singleband and maxbanddepth to 1. But i am not shure if this was going to help or the fact that i deleted the table relation on itself in the dataset.
My second problem is about loading the display layout. I wanted to load the layout from a database depending which user is 'logged in'. For this behavior i got a usercontrol with a wingrid. The first 'standard' design comes from a lyt-file when no layout (or standard-layout) could be found in the database. But sometimes columns which i made hidden are visible again and i don't know why.
Third problem is that after some changes the event 'AfterRowLayoutItemResized' didn't fire when i changed the size of a column-width or row-height. I wondered why know cause earlier it fires at this point. I tryed to delete the event and add it again but it still didn't work
And now a forth problem is that i could save the layout, but the layout won't load correctly. The column-width changes load correctly. But the Row-height changes won't load.
Thanks for your support.
Greetings from germany
Dietrich
Sample Code:
UserControl
private string user = GridExtensionClass.STANDARD_USER; public string User // this i how the usercontrol gets the userchange from the parent frame { get { return user; } set { user = value; GridExtensionClass.loadLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user); ultraGridWorkgroups.Refresh(); } }
private void ultraGridWorkgroups_AfterRowResize(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e) { GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user); } private void ultraGridWorkgroups_AfterColPosChanged(object sender, Infragistics.Win.UltraWinGrid.AfterColPosChangedEventArgs e) { GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user); } private void ultraGridWorkgroups_AfterRowLayoutItemResized(object sender, Infragistics.Win.UltraWinGrid.AfterRowLayoutItemResizedEventArgs e) //doesn't work anymore, event won't fire on row size/header changes { GridExtensionClass.saveLayout(ultraGridWorkgroups, ecU_UserLayoutsTableAdapter1, user); }
HelperFile:
public static void loadLayout(UltraGrid grid, ECU_UserLayoutsTableAdapter tableAdapter, string actualUser) { byte[] myData = (byte[])tableAdapter.ecu_loadLayout(actualUser, grid.Name); try { //grid.ResetLayouts(); //no changes on the row heights issue //grid.ResetDisplayLayout(); //no changes on the row heights issue grid.DisplayLayout.Load(new MemoryStream(myData)); } catch (ArgumentNullException ane) //if no layout is found in the database { loadRessourcesLayout(grid,tableAdapter); //GridExtensionClass.saveLayout(grid, tableAdapter, "Standard"); } }
Hi Dietrich,
Dietrich Schomberg said:My first problem is the datatable in my datasource which has a recursiv character / parent/child relation. The designer file sometimes takes few minutes to load and has over 50.000 lines of code an nearly a thousand band inherited. I tried the property singleband and maxbanddepth to 1. But i am not shure if this was going to help or the fact that i deleted the table relation on itself in the dataset.
You can limit the number of child bands that are created by the grid by setting the MaxBandDepth property. I recommend a setting between 5 and 8.
Dietrich Schomberg said:My second problem is about loading the display layout. I wanted to load the layout from a database depending which user is 'logged in'. For this behavior i got a usercontrol with a wingrid. The first 'standard' design comes from a lyt-file when no layout (or standard-layout) could be found in the database. But sometimes columns which i made hidden are visible again and i don't know why.
There's not much to go on here. If the layout is not loading properly, it could be because the grid's DataSource does not match the data structure of layout when it was saved. But if some things are loading properly and others are not, then I do not know of any reason why that would happen, unless your code is changing or resetting some properties of the grid after the layout has been loaded.
Dietrich Schomberg said:Third problem is that after some changes the event 'AfterRowLayoutItemResized' didn't fire when i changed the size of a column-width or row-height. I wondered why know cause earlier it fires at this point. I tryed to delete the event and add it again but it still didn't work
This event only fires when the grid band is using a RowLayout. So my guess is that something is changing the RowLayoutStyle on your band to Standard.
Dietrich Schomberg said:And now a forth problem is that i could save the layout, but the layout won't load correctly. The column-width changes load correctly. But the Row-height changes won't load.
This seems like the same thing as the second issue, to which I have already replied.
Thanks for yours answers on my on my first try with infragistics... it' s all a little bit different to the last tool we took for development... :-)
Your comments helped me to fix most of my problems.
The thing about changes in the datasource is which i still don't understand.
Does this explain why i can load layouts without any problem in one run of the application.
But when i save a layout only once (i mean calling the save routine) i'll have to restart the application. Cause the former correct loading of the layout doesn't work anymore. After restart all layouts (the actually saved one too) could be loaded correctly.
Thanks a lot for your help
Greetings from Germany