Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / August 2008



Tip: Looking for answers? Try searching our database.

Bind in CFGRID with a CFC, HELP!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
code_hound11 - 28 Aug 2008 16:09 GMT
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},{cfgridsortcolu
mn},{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>
MMFranklin - 28 Aug 2008 21:15 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.