Page 1 of 1

datagrid Column Names

Posted: Fri Mar 06, 2015 4:58 pm
by gepponline
Hi,
I'm trying to populate a datagrid with this dat:

Code: Select all

Nome Tabella	Tipo	Numero	Ubicazione
TF_FEMMINE	D 25	14	Meshpack
TF_FEMMINE	D 25	14	Meshpack
TF_FEMMINE	D 25	14	Meshpack
TF_FEMMINE	D 25	14	Meshpack
TF_FEMMINE	D 25	14	Meshpack
But when I put this code

Code: Select all

set the dgText[true] of group "censite" to gFiliera
The datagrid still empty.

If i change to false the "first line contains column" th datagrid get pupolated but with column names in the table.
What I'm doing wrong?

Re: datagrid Column Names

Posted: Fri Mar 06, 2015 5:20 pm
by Klaus
Buongiorno Geppo,

using the parameter TRUE with dgtext requires that all these columns are already "pre-made",
means you already created these columns: Nome, Tabella, Tipo, Numero, Ubicazione
in your datagrid.

Is this the case?


Best

Klaus

Re: datagrid Column Names

Posted: Fri Mar 06, 2015 5:35 pm
by gepponline
...So the columns should already have that names?
..no..that's not the case... I need to populate the data and also the column names that I don't know before i open the file where i have my data.

How to do it?

Re: datagrid Column Names

Posted: Fri Mar 06, 2015 6:07 pm
by Klaus
gepponline wrote:...So the columns should already have that names?
Yes, but the only use of this TRUE parameter is if your data do not come in the same order
as you /pre-made) columns in your datagrid.

In that case TRUE the dategrid will reorder the data to fit into the correct columns in your datagrid.
gepponline wrote:..no..that's not the case... I need to populate the data and also the column names that I don't know before i open the file where i have my data.
OK, so you have an EMPTY datagrid and need to define columns and then put data into the datagrid?

In that case you first need to define all neccessary columns like this:

Code: Select all

...
## You need to supply a CR delimited list of column names
put "Nome" & CR & "Tabella" & CR & "Tipo" & CR & "Numero" & CR & "Ubicazione" into tColumns

## Now create all these columns
set the dgProp["columns"] of grp "censite" to tColumns

## Now you can add data
set the dgText of grp "censite" to gFiliera
...
Hint:
here you find the only documantation of datagrids, load the PDF and read it about 1000 times :D
http://lessons.runrev.com/m/datagrid

You will see why after the first reading, datagrids are the most complex stuff EVER in Livecode!
Everytime i have a project where datagrids are involded I need to read thos PDF again and again 8)


Best

Klaus

Re: datagrid Column Names

Posted: Sat Mar 07, 2015 9:16 am
by gepponline
Thank you so much.
I know, data grid are very complex to understand but they seems very powerfull for every kind of use.

Geppo!

Re: datagrid Column Names

Posted: Wed Jun 03, 2015 9:05 am
by sphere
Thanks a lot Klaus.
Very good and useful!

Regards,
Sphere