1 Reply Latest reply on Mar 20, 2008 6:46 PM by Newsgroup_User

    cfgrid - agravating

    larksys
      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,typ e,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>