6

I have a TDataSource that is backed by a TClientDataset bound to a TStringGrid. I did this by right-clicking on the grid, selecting "Link to DB Datasource...", and selecting the DataSource. This setup the LiveBindings for me.

When I run the application, the grid only fills with 200 rows, even though there are 5000 records in the dataset.

I'm unable to find any documentation regarding how to change the number of rows displayed or the proper way to allow the user to scroll through all of the data.

I did find the hard coded 200 value in TBindScopeDBEnumerator.Create in the unit Data.Bind.DBScope, and when I increase it to 10000, I see all 5000 rows in the grid, but this seems like a hack.

What's the proper way to show more than 200 rows in a TStringGrid?

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
  • @kobik - FireMonkey doesn't have a TDBGrid component or any TDB style components. Instead you use standard TEdit, TStringGrid components with the new LiveBindings feature which amongst other things allows you to bind the values of the standard controls to the values of database fields. – LachlanG Dec 21 '11 at 22:35
  • sorry didn't realized it's a FireMonkey issue in the first place... :-P – kobik Dec 21 '11 at 22:45

2 Answers2

5

You can change the TBindDBGridLink.BufferCount for a value you want rather -1. But it's better to set the TBindDBGridLink.AutoBufferCount to True.

Wh1T3h4Ck5
  • 8,399
  • 9
  • 59
  • 79
Alain V
  • 311
  • 3
  • 17
  • 1
    setting the buffercount manually can really eat your memory, but so is loading giant datasets in the livebindings. – r_j Mar 06 '13 at 12:31
3

You need to change the TBindDBGridLink.BufferCount at designtime from -1 to whatever value you need.

LachlanG
  • 4,047
  • 1
  • 23
  • 35
  • 2
    I had tried changing this value already in code, in the OnCreate method of the form. Apparently, that was too late. You must change the value in the IDE at design time so that the value is set when it is created. It's crazy that -1 means 200. Thanks for the hint. – Marcus Adams Dec 22 '11 at 14:28
  • @lachlang Seems that for xe6 that is not valid anymore, do know about that? – Eduardo Elias Jul 30 '14 at 02:10