If I select a row on a StringGrid and read the dataset record (as I would on a dbgrid) the dataset cursor is set to the first record.
Is there a way to get the StringGrid to sync with the Dataset ?
Similarly when updating the dataset with a select query, the StringGrid does not sync and reflect the new data in the dataset (unless I set BindSourceDb.dataset := nil and then BindSourceDb.dataset = dataset after the query re-opens, which does not seem the correct approach). I am looking for a way to sync the StringGrid with the current dataset and selected record if a row if selected
I have a StringGrid with '*' Binding to BindSourceDb '*' and A BindPosition Link as detailed below. The BindSourceDB is linked at a TFDQuery dataset. I am using XE5.
object LinkGridToDataSourceBindSourceDB1: TLinkGridToDataSource
Category = 'Quick Bindings'
DataSource = BindSourceDB1
GridControl = dgCustomer
AutoBufferCount = False
Columns = <
item
MemberName = 'ID'
Width = 40
end
item
MemberName = 'NAME'
Header = 'Name'
Width = 300
end>
end
object BindPosition1: TBindPosition
Category = 'Links'
ControlComponent = dgCustomer
SourceComponent = BindSourceDB1
PosSourceExpressions = <
item
ControlExpression = 'Selected+1'
SourceExpression = 'RecNo'
end>
PosControlExpressions = <
item
ControlExpression = 'Selected'
SourceExpression = 'RecNo -1'
end>
PosClearExpressions = <>
end