Question
Passing cfselect value to cfgrid
Good Afternoon,
I am trying to pass the values from a cfselect box to filter the results in a CFGrid and then refresh the grid. Both of the objects are bound to a cfc method.
When I run the code I see the select box with the correct values and the unfiltered grid. I believe all I need to know is how to pass the value of the cfselect object to the cfc that is bound to the grid.
The CFM:
<cfform name="DisplayGrid">
<cfselect name="DebtIssue"
bind="cfc:Mint_DataQueries.IssuesForSelect()"
bindonload="true" multiple="true" size="5" onclick="ColdFusion.Grid.refresh('asynchgrid', true)" />
<cfgrid name="asynchgrid"
format="html"
pageSize="10"
bind="cfc:Mint_DataQueries.dmf_all({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
stripeRows="true"
stripeRowColor="##e0e0e0" selectmode="row" >
<cfgridcolumn name="debtname" header="Debt">
<cfgridcolumn name="debtissue" header="Issue">
<cfgridcolumn name="FSRC" header="FSRC">
<cfgridcolumn name="appropriation" header="Appropriation">
</cfgrid>
</cfform>
The CFC that the Grid and Select Box is bound to:
<cffunction name="dmf_all" output="false"
access="remote" returntype="any"
hint="Pulls in all DebtMasterFile records">
<cfargument name="cfgridpage" required="true" />
<cfargument name="cfgridpagesize" required="true" />
<cfargument name="cfgridsortcolumn" required="true" />
<cfargument name="cfgridsortdirection" required="true" />
<cfargument name="issuefilter" required="false" type="numeric" default="0"/>
<cfargument name="codefilter" required="false" type="numeric" default="0"/>
<cfargument name="fsrcfilter" required="false" type="numeric" default="0"/>
<cfargument name="appropriationfilter" required="false" type="numeric" default="0"/>
<cfargument name="fundfilter" required="false" type="numeric" default="0"/>
<cfset var mfrecords = ' />
<cfquery name="mfrecords" datasource="#Application.datasource#" result="QueryRezultz">
Select DMF.DebtID,
DMF.DebtNumber,
DMF.DebtName,
DMF.FSRCID,
FSRC.Fsrc,DebtDate, PrincipalDate, InterestDate,
DTT.DebtCode, DTT.DebtType,PrincipalAmount, InterestAmount,
DMF.AppropriationID,
Approp.Appropriation, Clerk, LastRev, ClerkRev,
DMF.codeID, DMF.FSRCID, DI.DebtIssue, DMF.IssueID,DMF.FundID,DMF.Active
from DebtMasterFile DMF
left outer join FSRC
on FSRC.FSRCID = DMF.FSRCID
left outer join DebtTypetitles DTT
on DTT.TitleID = DMF.CodeID
left outer join Appropriations Approp
on Approp.AppropriationID =
DMF.AppropriationID
left outer join DebtIssues DI
on DI.IssueID =DMF.IssueID
where 0 = 0
<cfif issuefilter neq 0>
AND DMF.IssueID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.issuefilter#">
</cfif>
<cfif issuefilter neq 0>
AND DMF.CodeID =
<cfqueryparam cfsqltype="cf_sql_tinyint" value="#arguments.codefilter#">
</cfif>
<cfif fsrcfilter neq 0>
AND DMF.FsrcID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.fsrcfilter#">
</cfif>
<cfif appropriationfilter neq 0>
AND DMF.AppropriationID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.appropriationfilter#">
</cfif>
<cfif fundfilter neq 0>
AND DMF.FundID =
<cfqueryparam cfsqltype="cf_sql_tinyint" value="#arguments.fundfilter#">
</cfif>
</cfquery>
<cfreturn QueryConvertForGrid(mfrecords, #arguments.cfgridpage#,#arguments.cfgridpagesize#)>
</cffunction>
<cffunction name="IssuesForSelect" access="remote">
<cfset var SelectData = "" />
<cfquery name="SelectData" datasource="#Application.datasource#"
result="SelectRezultz1">
Select IssueID, DebtIssue from DebtIssues
order by IssueID desc
</cfquery>
<cfset Issuez = arraynew(2)>
<cfset Issuez[1][1] = "0">
<cfset Issuez[1][2] = "--issue--">
<cfloop query="SelectData">
<cfset Issuez[SelectData.CurrentRow][1] =
SelectData.IssueID>
<cfset Issuez[SelectData.CurrentRow][2] = ltrim(SelectData.DebtIssue)>
</cfloop>
<cfreturn Issuez>
</cffunction>
Any Help would be appreciated.
Thanks,
Michael
I am trying to pass the values from a cfselect box to filter the results in a CFGrid and then refresh the grid. Both of the objects are bound to a cfc method.
When I run the code I see the select box with the correct values and the unfiltered grid. I believe all I need to know is how to pass the value of the cfselect object to the cfc that is bound to the grid.
The CFM:
<cfform name="DisplayGrid">
<cfselect name="DebtIssue"
bind="cfc:Mint_DataQueries.IssuesForSelect()"
bindonload="true" multiple="true" size="5" onclick="ColdFusion.Grid.refresh('asynchgrid', true)" />
<cfgrid name="asynchgrid"
format="html"
pageSize="10"
bind="cfc:Mint_DataQueries.dmf_all({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
stripeRows="true"
stripeRowColor="##e0e0e0" selectmode="row" >
<cfgridcolumn name="debtname" header="Debt">
<cfgridcolumn name="debtissue" header="Issue">
<cfgridcolumn name="FSRC" header="FSRC">
<cfgridcolumn name="appropriation" header="Appropriation">
</cfgrid>
</cfform>
The CFC that the Grid and Select Box is bound to:
<cffunction name="dmf_all" output="false"
access="remote" returntype="any"
hint="Pulls in all DebtMasterFile records">
<cfargument name="cfgridpage" required="true" />
<cfargument name="cfgridpagesize" required="true" />
<cfargument name="cfgridsortcolumn" required="true" />
<cfargument name="cfgridsortdirection" required="true" />
<cfargument name="issuefilter" required="false" type="numeric" default="0"/>
<cfargument name="codefilter" required="false" type="numeric" default="0"/>
<cfargument name="fsrcfilter" required="false" type="numeric" default="0"/>
<cfargument name="appropriationfilter" required="false" type="numeric" default="0"/>
<cfargument name="fundfilter" required="false" type="numeric" default="0"/>
<cfset var mfrecords = ' />
<cfquery name="mfrecords" datasource="#Application.datasource#" result="QueryRezultz">
Select DMF.DebtID,
DMF.DebtNumber,
DMF.DebtName,
DMF.FSRCID,
FSRC.Fsrc,DebtDate, PrincipalDate, InterestDate,
DTT.DebtCode, DTT.DebtType,PrincipalAmount, InterestAmount,
DMF.AppropriationID,
Approp.Appropriation, Clerk, LastRev, ClerkRev,
DMF.codeID, DMF.FSRCID, DI.DebtIssue, DMF.IssueID,DMF.FundID,DMF.Active
from DebtMasterFile DMF
left outer join FSRC
on FSRC.FSRCID = DMF.FSRCID
left outer join DebtTypetitles DTT
on DTT.TitleID = DMF.CodeID
left outer join Appropriations Approp
on Approp.AppropriationID =
DMF.AppropriationID
left outer join DebtIssues DI
on DI.IssueID =DMF.IssueID
where 0 = 0
<cfif issuefilter neq 0>
AND DMF.IssueID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.issuefilter#">
</cfif>
<cfif issuefilter neq 0>
AND DMF.CodeID =
<cfqueryparam cfsqltype="cf_sql_tinyint" value="#arguments.codefilter#">
</cfif>
<cfif fsrcfilter neq 0>
AND DMF.FsrcID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.fsrcfilter#">
</cfif>
<cfif appropriationfilter neq 0>
AND DMF.AppropriationID =
<cfqueryparam cfsqltype="cf_sql_smallint" value="#arguments.appropriationfilter#">
</cfif>
<cfif fundfilter neq 0>
AND DMF.FundID =
<cfqueryparam cfsqltype="cf_sql_tinyint" value="#arguments.fundfilter#">
</cfif>
</cfquery>
<cfreturn QueryConvertForGrid(mfrecords, #arguments.cfgridpage#,#arguments.cfgridpagesize#)>
</cffunction>
<cffunction name="IssuesForSelect" access="remote">
<cfset var SelectData = "" />
<cfquery name="SelectData" datasource="#Application.datasource#"
result="SelectRezultz1">
Select IssueID, DebtIssue from DebtIssues
order by IssueID desc
</cfquery>
<cfset Issuez = arraynew(2)>
<cfset Issuez[1][1] = "0">
<cfset Issuez[1][2] = "--issue--">
<cfloop query="SelectData">
<cfset Issuez[SelectData.CurrentRow][1] =
SelectData.IssueID>
<cfset Issuez[SelectData.CurrentRow][2] = ltrim(SelectData.DebtIssue)>
</cfloop>
<cfreturn Issuez>
</cffunction>
Any Help would be appreciated.
Thanks,
Michael