I have a form on which a Livegrid is bound to a Query.
I crate the form and change the query at runtime to display different data tables.
Query.Sql.Add('select customer_autoinc,customer_name,customer_phone from customer');
Query.Sql.Add('order by customer_name');
My problems are with this approach so far:
-The first row of the Livegrid starts with the first record. There is no caption for the fields.
-Although in the select there is the customer_autoinc field, I don't want to show it to the user.
I couldn't find column.visible property to hide it.
Thank you very much for your help!
Livebindings operates differently, the visibility is managed by a LinkGridToDataSource component that allows defining which column are visible. The caption / header can be set there as well. To know how to create a LinkGridToDataSource, please first use the LiveBindings wizard. When the connection is setup, you can still programmatically change the query.
Thank you for your answer. I managed not to show unwanted fields like this:
With LinkGridToDataSource.Columns.Add Do
Header := 'Customer';
MemberName := 'customer_name';
But this problem hasn't resolved:
"The first row of the Livegrid starts with the first record. There is no caption for the fields."
So it should be like this:
and instead it is like this:
I am fairly sure it must be some simple setting, but I don't know which.
Would you be so kind to help me? Thank you very much.
Do you have grid.FixedRows = 1 ?