Column Size & Order

With the product I was using before re-ordering & re-sizing columns at runtime was automatic.

Can someone tell me how to make that happen with a TDBAdvGrid?

Not having much luck with my guesses.


Do you call grid.AutoSizeColumns() after activating the dataset?

I missed the options property. Really easy. Sorry I thought I had looked at everything.

So a follow up. I can now resize and move columns.

ColumnSize will allow saving of column width.
But does the grid provide a way to save the new column order as well?

grid.ColumnStatesToString / grid.StringToColumnStates can do this. It persists column width, order & visibility.

Can i do this without persistent columns? I hate to design the complete grid, but want to allow the user to change (and save) the columns with order and with.

If i do this not, i get an error with list index out of bounds(2) in line 13793 of AdvGrid.StringToColumnStates. The iL-list only has two elements... To be precise: this little piece:

    for i := 0 to ColCount - 1 do
      FColumnOrder.Add(il.Items);     <----------- out of bounds

Any way around this?

Do you call grid.SetColumnOrder at the right-time? grid.SetColumnOrder should be called when your reference column setting is setup in the grid (as deviations to this reference order are stored in the column states, so, before column states can be properly persisted, it is important than the reference order is set correct.

No i did not. But now i call it once before the eventuality that user changes columns (which will cause the settings to go into the database, and this works... Thanks.