Jump to content
TaKo91

TFDQuery BindVisually to TStringGrid

Recommended Posts

I have a TFDQuery that returns a row from record. When binding it visually to TStringGrid is it possible to invert it, so the field names are displayed in rows and values in columns?

I would like to do the same for TFDTable when visually binding it to TStringGrid.

 

Id   |  Name  |   Role             Id   | 1      | 2
 1   |  John  |   admin      ->    Name | John   | Jane
 2   |  Jane  |   user             Role | admin  | user

Share this post


Link to post

It is not too complex to write the classes required to handle this, and decide how to orientate rows vs columns.

 

I did that for TMS TAdvStringGrid, where I first collect the data into a matrix (by column, then by row), then stuff the content into the grid in the orientation I prefer, automatically setting up the grid props, handling rows, cols, width sizing as well as titles, etc.

The matrix can be filled from a database query, or from a list of objects, or by code.

 

I wish I had time to do a rewrite for TStringGrid, as the lib has too much proprietary code to share as is. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×