CFGrid that opens external website when clicking on a row.

I have a database that has a URL field. The URL's can be different. This is what i currently have but nothing launches when i click on a row.
<cfform name="video" format="html" align="center">
	<cfgrid name="videolist" query="videos" format="html" autowidth="no" selectmode="ROW" onchange="getURL(''videolist.selectedItem.path, '_blank')">
		<cfgridcolumn name="vidname" header="Video Name" display="Yes" width="150"></cfgridcolumn>
		<cfgridcolumn name="software" header="Software" display="Yes" width="100"></cfgridcolumn>
		<cfgridcolumn name="keywords" header="Tags" display="Yes" width="300"></cfgridcolumn>
		<cfgridcolumn name="vidnumber" header="Number" display="Yes" width="100"></cfgridcolumn>
		<cfgridcolumn name="path" header="Location" display="Yes" width="300" ></cfgridcolumn>
		<cfgridcolumn name="dateadded" header="Date Entered" display="Yes" width="100"></cfgridcolumn>

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

getURL() is actionscript, used with format="flash" only.

Using the "href" & "hrefkey" attributes would be perfect for this. Sadly CFGRID doesn't support custom URL parameter names.  Closest I could come was using the hack from here. Listener code updated for CF11.

Disclaimer: Adobe has a bad habit of updating the JS stuff without warning, so don't be surprised if it breaks in CF 2016.  May want to look into other libs for creating grids instead of using cfgrid.

<!--- demo query --->
<cfset videos = queryNew("")>
<cfset queryAddColumn(videos, "vidname", ["abc","efg","hij"])>
<cfset queryAddColumn(videos, "path", ["1111","2222","3333"])>

     <title>Grid URL Demo</title> 
     <script type="text/javascript"> 
     function init(){ 
         var grid = ColdFusion.Grid.getGridObject("videolist"); 
	 function oncellclick (view, cell, cellIndex, record, row, rowIndex, e) {
		  var path = ColdFusion.getElementValue("videolist", "video", "path");
		  // REPLACE THIS WITH YOUR URL''+ path, '_blank');

<cfform id="video" name="video" format="html" align="center">
	<cfgrid  name="videolist" query="videos" format="html" autowidth="no" selectmode="ROW">
		<cfgridcolumn name="vidname" header="Video Name" display="Yes" width="150"></cfgridcolumn>
		<cfgridcolumn name="path" header="Location" display="Yes" width="300"></cfgridcolumn>
     <cfset ajaxOnLoad("init")>      

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bcrosby007Author Commented:
I ended up using jquery and a few other things to make it work.

Thanks for your help.
bcrosby007Author Commented:
I ended up using jquery and a few other things to make it work.

Dropping cfgrid for an external lib is really the way to go.  CFGrid is notoriously .. painful to extend, and ... like I mentioned, Adobe tends to break custom grid features with every update. So you're better off with another grid tool.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.