How to dynamically build a datagrid table
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Location: Palo Alto, CA put williamdjamieso into tEmail / put n@gmail.com after tEmail/ revmail tEmail
- Contact:
How to dynamically build a datagrid table
Hello, it has been a while since i used the datagrid and had a simple question about datagrid tables. Maybe it is so simple, that I couldnt find any other threads on it so I decided to ask.
If I were to query a database and pull out tables X, Y, and Z. And say I had a template for each X Y and Z and a behavior for each as well. But I didn't know in what order they will appear, sometimes X is first, sometimes Z. And they could appear multiple times and I need to label the columns accordingly and sometimes build as many as 20 columns. How would I go about doing that?
I looked at the api and was looking for function like "dgCreateColumn" or "dgSetColumnLabel" but I didn't see anything. Did I miss something?
-Will
If I were to query a database and pull out tables X, Y, and Z. And say I had a template for each X Y and Z and a behavior for each as well. But I didn't know in what order they will appear, sometimes X is first, sometimes Z. And they could appear multiple times and I need to label the columns accordingly and sometimes build as many as 20 columns. How would I go about doing that?
I looked at the api and was looking for function like "dgCreateColumn" or "dgSetColumnLabel" but I didn't see anything. Did I miss something?
-Will
Re: How to dynamically build a datagrid table
Hi Will,
you want to set a couple of properties:
Grab your PDF copy of the complete datagrid docs here: http://lessons.livecode.com/m/datagrid_tips
A TINY link, must be seven points or something, sigh, under the Topics on the left side.
I read it up again and again and again whenever I need to work with datagrids!
Or answer DG related questions here in the forum.
Best
Klaus
you want to set a couple of properties:
Code: Select all
...
set the dgProp["columns"] of grp "your dg here" to cr_delimited_list_of_columns
set the dgProp["column labels"] of grp "your dg here" to cr_delimited_list_of_column_labels
...
A TINY link, must be seven points or something, sigh, under the Topics on the left side.
I read it up again and again and again whenever I need to work with datagrids!
Or answer DG related questions here in the forum.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Location: Palo Alto, CA put williamdjamieso into tEmail / put n@gmail.com after tEmail/ revmail tEmail
- Contact:
Re: How to dynamically build a datagrid table
Thanks klaus! Exactly what i was missing
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: How to dynamically build a datagrid table
The PDF Klaus has referred you to has not been updated to use the current IDE interface.
If you are using LC 8.1 or above please check out the included Dat Grid guide.
It has been updated to the version 8 interface which helps in doing the exercises.
You access it via the "Guide" tab in the Dictionary window.
If you are using LC 8.1 or above please check out the included Dat Grid guide.
It has been updated to the version 8 interface which helps in doing the exercises.
You access it via the "Guide" tab in the Dictionary window.
Re: How to dynamically build a datagrid table
Yes, sorry, I forgot that the docs are now in the dictionary in LC 8.1!
-
- VIP Livecode Opensource Backer
- Posts: 212
- Joined: Fri Feb 01, 2013 1:31 am
- Location: Palo Alto, CA put williamdjamieso into tEmail / put n@gmail.com after tEmail/ revmail tEmail
- Contact:
Re: How to dynamically build a datagrid table
Im sad to say that is what I was using , I just didnt see the dgProps["columns"]. I must have just missed it.
Thanks!
Thanks!