Copy link to clipboard
Copied
i want to display the records in the cfgrid with cfgridcolumn but wonder if it is possible to use the group by query by any ways?
<cfoutput query="myquery" group="column">
.....display records here----
</cfoutput>
instead of above cfoutput query, I wan to display them in the cfgrid below but how can i groupd by the ID field here?
<cfform name="frmGrid" id="frmGrid">
<cfgrid
name="gridOutages"
format="HTML"
query="myquery">
<cfgridcolumn name="id" header="Message ID" width="50" href="entry_form.cfm?action=edit" hrefkey="id" />
<cfgridcolumn name="title" header="Title" width="100" />
</cfgrid>
</cfform>
Thanks
Copy link to clipboard
Copied
As far as I am aware, cfgrid has no functionality equivalent to cfoutput's 'group' attribute. The closest comparison is cfgrid's 'groupfield' attribute. However, the two produce quite different results.
If you apply group="ID" to cfoutput, it will return rows with distinct IDs only. That is, it will pick out the first row that has the ID value, and discard all other rows that share the same ID. Whereas, cfgrid's setting, groupfield="ID", returns all rows, but groups them according to ID value.
Copy link to clipboard
Copied
<cfgrid> has its own grouping attribute:
<cfgrid ...
groupField="#myQuery.myColumn#">