datagrid Column Names

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

datagrid Column Names

Post by gepponline » Fri Mar 06, 2015 4:58 pm

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?

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: datagrid Column Names

Post by Klaus » Fri Mar 06, 2015 5:20 pm

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

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: datagrid Column Names

Post by gepponline » Fri Mar 06, 2015 5:35 pm

...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?

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: datagrid Column Names

Post by Klaus » Fri Mar 06, 2015 6:07 pm

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

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: datagrid Column Names

Post by gepponline » Sat Mar 07, 2015 9:16 am

Thank you so much.
I know, data grid are very complex to understand but they seems very powerfull for every kind of use.

Geppo!

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: datagrid Column Names

Post by sphere » Wed Jun 03, 2015 9:05 am

Thanks a lot Klaus.
Very good and useful!

Regards,
Sphere

Post Reply