Creating Datagrid columns from a list

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Creating Datagrid columns from a list

Post by quailcreek » Fri Aug 25, 2017 9:29 pm

Hi,
I was looking for something like dgCreateColumn but couldn't find anything. I need to create some datagrid columns from a list. I know how to run the repeat statement I'm just looking for the create a column command. Has anybody done this? Thanks in advance.
Tom
MacBook Pro OS Mojave 10.14

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Creating Datagrid columns from a list

Post by Klaus » Fri Aug 25, 2017 10:06 pm

Hi Tom,

you need to set "the dgProp["columns"]" of your datagrid:

Code: Select all

set the dgProp["columns"] of group "Data Grid" to cr_delimited_list_of_column_names
will overwrite existing columns however.

To ADD new columns do something like:

Code: Select all

put the dgProp["columns"] of group "Data Grid" to into columns_old
put columns_old & CR & cr_delimited_list_of_column_names into columns_new
set the dgProp["columns"] of group "Data Grid" to columns_new
Best

Klaus

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Creating Datagrid columns from a list

Post by quailcreek » Fri Aug 25, 2017 10:16 pm

Perfect Klaus, thanks.
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Talking LiveCode”