Hi Guys,
I am working on project using table field to display data so I now want to use datagrid instead.
The problem is there are any way to generate dynamically columns of datagrid by specific arrays. For example:
1. I have drop box have 2 options to select: option1,option2
2. I want only 1 datagrid to display records. If user select option1 the columns of datagrid now is ID,Name and Age. Otherwise, datagrid now is ID and Name
Could you guys please give me some solutions with this problems?
So appreciated !
Regards,
Quang
Generate dynamically columns in datagrid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Generate dynamically columns in datagrid
Hi Quang,
you can show and hide a single column in your datagrid!
So you can use the SAME data, but only show/hide the AGE column.
Maybe this will help you?
Check the DataGrid docs for:
---------------------------------
dgColumnIsVisible [COLUMN]
- Get/set the visibility of the column.
--------------------------------
Get the complete docs as PDF here:
http://lessons.runrev.com/s/lessons/m/datagrid
Best
Klaus
you can show and hide a single column in your datagrid!
So you can use the SAME data, but only show/hide the AGE column.
Maybe this will help you?
Check the DataGrid docs for:
---------------------------------
dgColumnIsVisible [COLUMN]
- Get/set the visibility of the column.
--------------------------------
Get the complete docs as PDF here:
http://lessons.runrev.com/s/lessons/m/datagrid
Best
Klaus
Re: Generate dynamically columns in datagrid
Hi Klaus,
Thanks so much for your reply.
I just found the ideas but it just only create 1 column.Here is my code:
It's just create column with name "Test1".
Thanks in advance,
Regards,
Quang
Thanks so much for your reply.
I just found the ideas but it just only create 1 column.Here is my code:
Code: Select all
put "Test" into tLineArray1[1]
put "Test1" into tLineArray1[2]
repeat for each key tKey in tLineArray1
set the dgprops ["columns"] of group "List3" to tLineArray1[tKey]
end repeat
It's just create column with name "Test1".
Thanks in advance,
Regards,
Quang
Re: Generate dynamically columns in datagrid
Hi Quang
please check and read the PDF!
This property needs a CR list for the new columns!
Table properties:
....................
columns
- Line delimited list of columns in your table.
....................
You are overwriting the one and only column in your repeat loop!
Try this:
...
put "Test" & CR & "Test1" into tColumns
set the dgprops ["columns"] of group "List3" to tColumns
...
Best
Klaus
please check and read the PDF!
This property needs a CR list for the new columns!
Table properties:
....................
columns
- Line delimited list of columns in your table.
....................
You are overwriting the one and only column in your repeat loop!
Try this:
...
put "Test" & CR & "Test1" into tColumns
set the dgprops ["columns"] of group "List3" to tColumns
...
Best
Klaus
Re: Generate dynamically columns in datagrid
Dear Klaus,
Thanks you very much ^^. I'm so stupid
Regards,
Quang
Thanks you very much ^^. I'm so stupid
Regards,
Quang