|
|
Ken,
Actually what I'm trying to do is very simple.
The select list will show names of tables (sorry I just realized that my
naming is wrong. it should be tableName instead of dbname) and when one of the
table is selected, the grid will show the content/all columns of that table
So the component has a function where the query is selecting columns from the
table selected from the drop down list. That's it.
I will not use any query anymore, this is just to show what are the content of
each tables.
Later on I'm learning to add new and update on the grid but for now
I just want to show the content of each table in the grid based on what is
selected from the drop down.
As far as the columns of each table to be shown on the grid, they are
different, so what I currently have (and is working, except that I don't like
the idea of using cfset application.dbname) is using the cfswitch to
navigate to which cfgridcolumn to be used based on the selected table
name.(see the logic on the code provided below)
I copy and pasted your example, it is working but only for 1 group of
cfgridcolumn. It doesn't make sense to have the selection of table names in the
drop down if what is shown on the grid is only a content of one of the table.
Since the beginning I don't know how to connect the selected table name with
the cfgrid. This is the reason why I separated the drop down and the cfgrid in
2 CFFORMs
I pasted your example and my cfswitch for you so you can see much clearly what
I'm trying to do here.
<CFSWITCH expression="#form.adc#">
<CFCASE value="Bio">
<cfgridcolumn name="FName"
header="First Name" width="100"/>
<cfgridcolumn name="LName"
header="Last Name" width="120"/>
<cfgridcolumn name="Add"
header="Address" width="120"/>
<cfgridcolumn name="City"
header="City"width="100"/>
<cfgridcolumn name="State"
header="State" width="150"/>
<cfgridcolumn name="Zip" header="Zip
Code" width="300"/>
</CFCASE>
<CFCASE value="Dept">
<cfgridcolumn name="HR" header="Human
Resources" width="100"/>
<cfgridcolumn name="IT"
header="Information Technology" width="120"/>
<cfgridcolumn name="Add"
header="Admission" width="120"/>
<cfgridcolumn name="Reg"
header="Registration" width="150"/>
<cfgridcolumn name="Fin"
header="Financial Aids" width="100"/>
</CFCASE>
</CFSWITCH>
|
|