CF 9 Related grid columns: How update 2nd column from change in 1st column
i want update value in 1 dropdown column , display associated data
in second dropdown column in cfgrid.
for starters, want display current choices 2 columns database well
as associated items second column in dropdown list.
since columns related, call cfc grid's bind in cfm file. function gets value of 1st column,
then calls (through cfinvoke) function allowable items second column.
the second function return correct 2nd column values, but
i can't display 2nd column's values in cfgridcolumn's
values , valuesdisplay attributes in cfm file.
this gridcolumn code 2nd column:
<cfgridcolumn name="labor_cat" header="labor category"
values="#valuelist(catnames.catname)#"
valuesdisplay="#valuelist(catnames.catname)#">
catnames returnvariable function cfinvoking second function.
here's 1st function:
<cffunction name="getftes" access="remote" returntype="struct">
<cfargument name="page" type="numeric" required="yes">
<cfargument name="pagesize" type="numeric" required="yes">
<cfargument name="gridsortcolumn" type="string" required="no" default="">
<cfargument name="gridsortdir" type="string" required="no" default="">
<cfargument name="rcp_id" type="string" required="yes">
<cfset var qgetftes = "" />
<!--- select associated ftes chosen rcp --->
<cfquery name="qgetftes" datasource="#request.atcdsn#">
select fte_id, fte.rcp_id, funding_year, labor_cat,labor_band,number_of_ftes,
fte.entry_date, fte.entered_by
fte, rcp_table
fte.rcp_id = #rcp_id# , fte.rcp_id = rcp_table.rcp_id
<cfif arguments.gridsortcolumn neq "" , #arguments.gridsortdir# neq "">
order #arguments.gridsortcolumn# #arguments.gridsortdir#
</cfif>
</cfquery>
<cfinvoke component = "getrcpsforftes" method="getassoccats" returnvariable="catnames">
<cfinvokeargument name="laborband" value="#qgetftes.labor_band#">
</cfinvoke>
<cfreturn queryconvertforgrid(qgetftes, arguments.page, arguments.pagesize)>
</cffunction>
here 2nd function:
<cffunction name="getassoccats" access="remote" returntype="string">
<cfargument name="laborband" type="string" required="yes">
<cfquery name="getbandid" datasource="#request.atcdsn#">
select band_id
laborband_lkup
band_name = '#arguments.laborband#'
</cfquery>
<cfquery name="getassoccatids" datasource="#request.atcdsn#">
select fk_cat_id
labor_bandcat_lkup
fk_band_id = #getbandid.band_id#
</cfquery>
<cfquery name="getassoccatnames" datasource="#request.atcdsn#">
select cat_name
laborcat_lkup
cat_id = #getassoccatids.fk_cat_id#
</cfquery>
</cffunction>
here's grid in cfm file:
<cfgrid name="rcpftes" format="html"
title="ftes on rcp"
pagesize="5"
collapsible="yes"
selectmode="edit"
striperows="yes"
selectonload="false"
bindonload="no" bind="cfc:atc_test._cfc.getrcpsforftes.getftes({cfgridpage},
{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{rcps4ftes.rcp_id})"
onchange="cfc:atc_test._cfc.getrcpsforftes.upfte({cfgridaction},
{cfgridrow},
{cfgridchanged}
)">
<cfgridcolumn name="rcp_id" header="rcp id" display="no">
<cfgridcolumn name="fte_id" header="fte id" display="no">
<cfgridcolumn name="funding_year" header="funding year" select="no">
<cfgridcolumn name="labor_band" header="labor band" select="no">
<cfgridcolumn name="labor_cat" header="labor category"
values="#valuelist(catsname.catname)#"
valuesdisplay="#valuelist(catsname.catname)#">
<cfgridcolumn name="labor_group" header="labor group">
<cfgridcolumn name="number_of_ftes" header="number of ftes">
<cfgridcolumn name="entry_date" header="last changed on" select="no">
<cfgridcolumn name="entered_by" header="last changed by" select="no">
</cfgrid>
catnames returnvariable function cfinvoking second function.
i had tried using <cfreturn queryconvertforgrid(getassoccatnames) in second function , using "getassoccatnames" in cfgridcolumn,
but didn't work.
any ideas or other approaches?
thanks assistance!
More discussions in Advanced Techniques
adobe
Comments
Post a Comment