Just noticed this on a grid that is hosted on a TabItem: If the tab is not selected, no records are being created at all although RecordLoadMode is set to PreLoadRecords. I don't know whether this is behaviour is intended, but I'd say it's a bit dangerous: I iterated through all records of my grid to read the values of an unbound field. However - as PreLoadRecords didn't kick in, there were no records at all - no runtime exception but invalid result...
Is there a way to ensure that the grid reliably returns what was defined as its data source?
Cheers,
Philipp
The PreloadRecords setting should not be necessary at all. This is a bug. We had delayed the record initialization intentionally because the control doesn't need it until its gets hydrated.
We just fixed this by also triggering the record initialization on the gets of the Records or ViewableRecords properties.
Unfortunately there is no workaround with the build you have.
Knowing that it'll work out of the box is better than introducing a hack - can't wait to get my hands on the RC...
Edit: It seems the RC bits still contain the bug
Thanks for the tip! Are you already working with 7.2 RTM or is there a chance this has been fixed in the meantime?
Cheers, Philipp
I got the same problem, the grid didn't preload the rows until the user interacts on it.
I think i've found a workaround: after loading the grid i call the Application.DoEvents and then i sort by the unbound column.
When you sort by a column, the grid needs to know every value in the cell , so the grid loads all the data. If you don't want to leave the grid sorted by this column you can just delete the sorted column.
My code looks like this:
Grid.Datasource = MyDataset
Application.DoEvents() If Grid.DisplayLayout.Bands(0).SortedColumns.Exists("ColumnControl") Then Grid.DisplayLayout.Bands(0).SortedColumns.Remove("ColumnControl") End If Grid.DisplayLayout.Bands(0).SortedColumns.Add("ColumnControl", True, False) Grid.DisplayLayout.Bands(0).SortedColumns.Remove("ColumnControl")
Hope this helps!!