Note: This will prevent any rows from being selected at all, so if you need people to be able to actually select the row for some other purpose then this is probably not the way to go.
Click Here to Browse the results of the sample code above.
I am not sure yet how else to disable the highlighting because it appears to be something that has to be set when the Grid is first initialized and that is done by ColdFusion behind the scenes. In the interest of getting my project done on time, I decided to just disable the ability to select a row in the grid because my particular screen did not need to know which row they selected. If I have time later, I will probably revisit this and try to find a better way, but in the mean time, if you know a way to disable the selected row highlighting without disabling row selection all together please leave me a comment below.
How do make the Button in each row of the Cfgrid ?
This is the getCoupons function in my coupons.cfc file:
<cffunction name="getCoupons" access="remote" returnType="struct">
<cfargument name="page" type="numeric" required="yes">
<cfargument name="pageSize" type="numeric" required="yes">
<cfargument name="gridsortcolumn" type="string" required="no" default="">
<cfargument name="gridsortdir" type="string" required="no" default="">
<!--- Local variables --->
<cfset var data="">
<!--- Get data --->
<cfquery name="data" datasource="#THIS.dsn#" username="#THIS.dsnusername#" password="#THIS.dsnpassword#">
SELECT COUPONID, SPONSORID, COUPON, EXPIRATIONDATE
<cfset qryFinalQuery = QueryNew("COUPONID, SPONSORID, COUPON, EXPIRATIONDATE, DoSomethingBtn","varchar,varchar,varchar,varchar,varchar") />
<cfset QueryAddRow(qryFinalQuery) />
<cfset QuerySetCell(qryFinalQuery, "COUPONID", "#data.COUPONID#") />
<cfset QuerySetCell(qryFinalQuery, "SPONSORID", "#data.SPONSORID#") />
<cfset QuerySetCell(qryFinalQuery, "COUPON", "#data.COUPON#") />
<cfset QuerySetCell(qryFinalQuery, "EXPIRATIONDATE", "#DateFormat(data.EXPIRATIONDATE, 'mm/dd/yyyy')#") />
<cfset QuerySetCell(qryFinalQuery, "DoSomethingBtn", "<input type=""Button"" value=""Do Something"" onclick=""alert('You just did something!');"">") />
<!--- And return it as a grid structure --->
Pretty nice stuff I would say. I also hope you may have an answer to my question on CF HTML grid. I tried to find the answer on EXT forum but no luck so far.
I have HTML grid binded to CFC.
<cfgrid name = "ShiftGrid" format="html" pagesize=11 width="644" selectcolor="##C0ADA5"
colheaderbold="yes" selectmode="row" sort="yes" selectOnLoad="false"
<cfgridcolumn name = "ShiftID" display="true" header="ID" width="40">
<cfgridcolumn name = "Name" display="true" header="Description" width="604">
I also have CFFORM elements binded to grid columns and buttons Insert, Update, Delete binded to CFC using AJAX proxy.
Everything works fine except: when I set sort on the grid column and make changes to the record that moves it to the other page of the grid because of the sort.
On grid refresh (ColdFusion.Grid.refresh('ShiftGrid', false)) my grid stays on the same page it was before edit but all my form elements points to the element I just edit.
(ColdFusion.Grid.refresh('ShiftGrid', true)) doesn't help.
I don't think it is a proper behaviour. How can I make grid to show page where edited record is after refresh? It would also be nice to highlight it.
It should be connected with using listeners to record selected ROW position and restore it, but how?
Last week i am trying cfgrid tag for my sample application.
Any idea to do with coldufsion completely.
I use it in IE - I tried to troubleshoot it in firefox, but it works just
Any ideas? Thanks!
thought I could use disableGridHighlight() to disable the issue
I am having with the colors when a row is selected (which it does)
but it is also disabling the functionality (links) I really need.... :-(