0
I am creating a simple system to test the operation of Delphi with Webservice REST, the first test is a database search that in this case is working all right, only that when the data is loaded in Dbgrid the view looks horrible, I wonder if you have how to customize the display of this information how to change the name and size of the columns.
Dbgrid:
As you can see, it gets really bad with these giant fields for little information and these column titles get the name that comes from WS.
I used the REST Debugger tool to do this WS communication with Grid.
At any event after the data is loaded (maybe at the end of the Search button event) do a for of the grid columns and check the size of the field by the dataset (e.g. string(200)), then calculate the column width, make for example 200 * 3 and you will have an approximate size appropriate to the field size.
– Andrey
Usually when the
DBGrid
is completed at runtime, itself defines the propertyWidth
of each column. Given this, some get very large even size, in some cases it is even unnecessary. My suggestion: Leave fields inDBGrid
configured so that when receiving the return from REST, just fill and do not configure.– Lucas de Souza Cruz
@Lucasdesouzacruz my problem is just trying to leave already configured, since I can not add Fields in Tfdmemtable to be able to configure Fields on the grid, there is no other way to configure it, because I only know using a Query and a Datasource (Firedac).
– Taha tsu
Well, if you double-click on the
Grid
you can add the fields you need to display. Setting it up is easy, just inform theTitle
and theFieldName
and ready.– Lucas de Souza Cruz
@Lucasdesouzacruz then, the problem is that when I click on the Fieldname error: Cannot open dataset, I probably have to add a new component or configure something in Tfdmemtable, but anyway I was able to set up right the way I wanted using Andrey’s tip.
– Taha tsu