Skip to main content
Participant
August 28, 2008
Question

Bind in CFGRID with a CFC, HELP!

  • August 28, 2008
  • 1 reply
  • 280 views
Hey everybody, I am new to the world of CFC's and have run into a roadblock with trying to utilize CFGRID. I want to do a BIND expression and I thought I had the correct syntax but no avail. Im passing a Form variable (search_mfg) to the results page. Ill post my CFC and results page below... any help is really appriciated... thank you!

CFC Page
++++++++++++++++++++++

<!--- Search Manufacturer Component --->
<CFCOMPONENT HINT="Manufacturer Detail" >

<!--- List users method --->
<CFFUNCTION NAME="Search_Mfg" access="remote" returntype="struct">
<cfargument name="search_mfg" required="true" />
<cfargument name="page" required="true" />
<cfargument name="pageSize" required="true" />
<cfargument name="gridsortcolumn" required="true" />
<cfargument name="gridsortdirection" required="true" />

<cfif arguments.gridsortcolumn eq "">
<cfset arguments.gridsortcolumn = "ProductTitle" />
<cfset arguments.gridsortdirection = "asc" />
</cfif>

<!--- Get manufacturer detail --->


<cfquery datasource="marinepowerservice" name="qry_getMfg">
Select *
From Products_kel
WHERE ManufacturerID = '#search_mfg#'
<cfif ARGUMENTS.gridsortcolumn NEQ "" and ARGUMENTS.gridsortdir NEQ "">
ORDER BY #ARGUMENTS.gridsortcolumn# #ARGUMENTS.gridsortdir#
<cfelse>
ORDER BY ProductItemNbr
</cfif>

</cfquery>

<CFRETURN queryconvertforgrid(qry_getMfg, page, pagesize) />

</CFFUNCTION>

</CFCOMPONENT>




Results Page
++++++++++++++++++++++++++

<cfform name="test">
<cfgrid
name="result"
format="html"
width="702"
bind="cfc:productsearch.Search_Mfg({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{form:search_mfg})"
colheaderbold="yes"
pagesize="5"
highlighthref="yes"
pictureBar = "Yes"
>

<cfgridcolumn name="PRODUCTID" header="ID" width="50">
<cfgridcolumn name="Manufacturer" header="Mfg">
<cfgridcolumn name="titlelink" header="Title" width="250">
<cfgridcolumn name="ProductItemNbr" header="Item Number">
<cfgridcolumn name="DateEntered" header="Posted">

</cfgrid>
</cfform>

This topic has been closed for replies.

1 reply

Known Participant
August 28, 2008
In CFC
#search_mfg# should be ARGUMENTS.search_mfg

also

In bind statement
{form:search_mfg})" should be {Name_of_Form:Name_of_Form_Field@onchange} or whichever event you want