• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfgrid - agravating

Explorer ,
Mar 20, 2008 Mar 20, 2008

Copy link to clipboard

Copied

This code works with the query on the form. If I bind to a cfc, it does not work. I just get and empty grid with a sdpinning icon

<cfquery name="Qgrid" datasource="#request.dsn#" dbtype="ODBC" maxrows="10">
SELECT companies.id,name,phone,city,state,Parent_Company_Number,Phone_Country_Prefix,Country,type,type_description
FROM companies
LEFT JOIN companies_Types
ON companies.Type = Companies_Types.Company_Type
ORDER BY name,city
</cfquery>
<cfgrid format="html" name="grid_Companies" pagesize="40" selectmode="row" bindonload="yes" query="Qgrid"
>
<cfgridcolumn name="ID" display="No"/>
<cfgridcolumn name="Name" header="Name" />
<cfgridcolumn name="Phone" header="Phone" />
<cfgridcolumn name="City" header="City" />
<cfgridcolumn name="State" header="State" />
<cfgridcolumn name="Type" header="Type" />

</cfgrid>

---------------------------------------------------------------------------------------------------------------
This code does not work

<cffunction name="getCompaniesForGrid" access="remote" output="no">
<cfargument name="page" required="yes">
<cfargument name="pageSize" required="yes">
<cfargument name="gridsortcolumn" required="yes">
<cfargument name="gridsortdirection" required="yes">
<cfset var gridResults="">
<cfquery name="gridResults" datasource="#request.dsn#">
SELECT id,name,city,state,type,phone
FROM companies
<cfif gridsortcolumn neq ''>
order by #gridsortcolumn# #gridsortdirection#
<cfelse>
ORDER BY name,city
</cfif>
</cfquery>
<cfreturn queryconvertforgrid(gridResults,page,pagesize)/>
</cffunction>

<cfgrid format="html" name="grid_Companies" pagesize="40" selectmode="row" bindonload="yes"
bind="cfc:cfc.basic.GetCompaniesForGrid({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">
<cfgridcolumn name="ID" display="No"/>
<cfgridcolumn name="Name" header="Name" />
<cfgridcolumn name="Phone" header="Phone" />
<cfgridcolumn name="City" header="City" />
<cfgridcolumn name="State" header="State" />
<cfgridcolumn name="Type" header="Type" />

</cfgrid>
TOPICS
Advanced techniques

Views

274

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2008 Mar 20, 2008

Copy link to clipboard

Copied

LATEST
you can't bind a grid to a query on the same page.
cfgrid can be 'binded' only to: cfc, javascript function or url.

i do not see any 'bind' attribute in your code. thus bindonload will
probably at least not work, and likely create an error like the one you
see...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation