Walk around for CFGRID

This is a discussion on Walk around for CFGRID within the Cold Fusion forums in Application Servers & Tools category; I found just a little walk aroud in CFGRID/HEREF tag for solve two problems: remove the underline of the text in the grid and format the output with cf function , put inside the cell a html tag or put that You want. The idea is simple, in the CFC create a new query object with the data from the main query and your process string . <cfcomponent> <cffunction name="getData" access="remote" output="false"> <cfargument name="page"> <cfargument name="pageSize"> <cfargument name="gridsortcolumn"> <cfargument name="gridsortdirection"> <cfquery name="getOrdini" datasource="#dsn#"> SELECT DatiOrdine.*, Clienti.* FROM Clienti INNER JOIN DatiOrdine ON Clienti.UUID = DatiOrdine.UUID WHERE DatiOrdine.stato <> 4 <cfif ...

Go Back   Application Development Forum > Application Servers & Tools > Cold Fusion

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-23-2008, 09:39 AM
piquadro
Guest
 
Default Walk around for CFGRID

I found just a little walk aroud in CFGRID/HEREF tag for solve two problems:
remove the underline of the text in the grid and format the output with cf
function , put inside the cell a html tag or put that You want.
The idea is simple, in the CFC create a new query object with the data from
the main query and your process string .

<cfcomponent>
<cffunction name="getData" access="remote" output="false">
<cfargument name="page">
<cfargument name="pageSize">
<cfargument name="gridsortcolumn">
<cfargument name="gridsortdirection">
<cfquery name="getOrdini" datasource="#dsn#">
SELECT DatiOrdine.*, Clienti.*
FROM Clienti INNER JOIN DatiOrdine ON Clienti.UUID =
DatiOrdine.UUID
WHERE DatiOrdine.stato <> 4
<cfif gridsortcolumn neq "" or gridsortdirection neq "">
order by #gridsortcolumn# #gridsortdirection#
</cfif>
</cfquery>
<!--- --->
<cfset miaQuery = QueryNew("IDdatiOrdine, dataOraCompilazione,
nomeCognomeRagioneSociale, indirizzo, e_mail, telefono, metodoPagamento,
PesoOrdine, totale, scheda","BigInt, VarChar, VarChar, VarChar, VarChar,
VarChar, VarChar, VarChar, VarChar, VarChar")>
<cfset nRecord = getOrdini.recordCount>
<cfset nuovaRiga = QueryAddRow(miaQuery, #nRecord#)>
<cfset idx = 0>
<cfoutput query="getOrdini">
<cfset idx = idx +1>
<cfset temporanea = QuerySetCell(miaQuery, "IDdatiOrdine",
"#IDdatiOrdine#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "dataOraCompilazione",
"#LSDateFormat(dataOraCompilazione,'DD/MM/YYYY')#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "nomeCognomeRagioneSociale",
"#nomeCognomeRagioneSociale#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "indirizzo", "#cap# #localita#
#indirizzo#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "e_mail", "<a
href='mailto:#e_mail#'>#e_mail#</a>", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "telefono", "#telefono#", #idx#)>
<cfif #metodoPagamento# IS "cartaDiCredito">
<cfset pagamento="Carta di Credito">
<cfelse>
<cfset pagamento="Contrassegno">
</cfif>
<cfset temporanea = QuerySetCell(miaQuery, "metodoPagamento",
"#pagamento#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "PesoOrdine", "Kg.
#PesoOrdine#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "totale", "&euro;
#DecimalFormat(totale)#", #idx#)>
<cfset temporanea = QuerySetCell(miaQuery, "scheda", "<a
href='gestOrdini2.cfm?IDdatiOrdine=#IDdatiOrdine#' >apri</a>", #idx#)>

</cfoutput>
<!--- --->
<cfreturn QueryConvertForGrid(miaQuery, page, pageSize)>
</cffunction>
</cfcomponent>

================================================== =

<style type="text/css">
.x-grid-row td {white-space:normal;}
</style>
<!--- --->
<cfform name="form01">
<cfgrid width="900" format="html" name="grid01" pagesize=14 sort=true
bind="cfclaces.getData({cfgridpage},{cfgridpages ize},{cfgridsortcolumn},{cfgri
dsortdirection})">
<cfgridcolumn name="IDdatiOrdine" display=true header="Nr." />
<cfgridcolumn name="dataOraCompilazione" display=true header="Data" />
<cfgridcolumn name="nomeCognomeRagioneSociale" display=true
header="Cliente" />
<cfgridcolumn name="indirizzo" display=true header="Indirizzo" />
<cfgridcolumn name="e_mail" display=true header="e-mail" />
<cfgridcolumn name="telefono" display=true header="Telefono" />
<cfgridcolumn name="metodoPagamento" display=true header="Pagamento" />
<cfgridcolumn name="PesoOrdine" display=true header="Peso totale" />
<cfgridcolumn name="totale" display=true header="Prezzo totale" />
<cfgridcolumn name="scheda" display=true header="Scheda" />
</cfgrid>
</cfform>

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:10 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.