Solved

cfgrid-show image

Posted on 2010-09-16
5
668 Views
Last Modified: 2012-05-10
Hello experts.
i need help to show images in a cfrid,instead of the name of the image(img_text) in the following example:
<cfgrid name="All_imagesgrid" format="html" pagesize="30" insert = "Yes"   sort="yes" width="100%"
    rowheaderbold="yes" colHeaderBold = "Yes"    pictureBar="yes" hspace="0" vspace="0"  bind="cfc:cfc.All_images.getAll_images({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{filtercolumn},{filter})"  selectmode="single">
      <cfgridcolumn name="artimages_ID" header="artimages_ID"  select="no" display="false"/>
      <cfgridcolumn name="img_id" header="img_id" width="30" numberformat="9" select="no" display="false"/>
      <cfgridcolumn name="img_text" header="img_text" />
     
   </cfgrid>

Any help?
0
Comment
Question by:Panos
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:reiters
ID: 33691936
I have created a query recordset manually and pushed all the query results into it but also added html to a column of my creation.  In my case I wanted some links.  It worked but was very slow.  You might find that using jQuery grid.  It can give a little more control if you have any experience with javascript.

The typed code may have some mistakes as I typed it without testing, but should give the idea.
<cfquery name='foo'>
  ....
</cfquery>
<cfset bar = querynew('one,two,html_img')>
<cfloop query='foo'>
   <cfset queryaddrow(bar)>
   <cfset querysetcell(bar,'one',foo.one)>
   <cfset querysetcell(bar,'two',foo.two)>
   <cfset querysetcell(bar,'html_img','<img src="#foo.img_name#">')>
</cfloop>

Open in new window

0
 
LVL 2

Author Comment

by:Panos
ID: 33700239
Hi reiters.
Thank you for your help.As i see it will be very complicated for me.Using my code i have a grid where i can add,delete,alter,sort all the data.
So i will have to change all these with jquery (i use jquery but for othr functions and using tutorials without javascript experience) and i don't know if i can do it.
A better idea is to use a second grid with flash format to show only the images.
I hope i will get another solution,otherwise i will close the question.
0
 
LVL 2

Author Comment

by:Panos
ID: 33700280
Another idea.
Can i use jacascript and cfwindow and when i click on the row with img_text (<cfgridcolumn name="img_text" header="img_text" />) to show the image in the cfwindow.(or jquery)
0
 
LVL 6

Accepted Solution

by:
reiters earned 500 total points
ID: 33701359
jQuery is easier in my opinion because it doesn't play games with your java script.  It can be done in either.  What I'm suggesting is this.

1.  Query the data you want
2. create a new blank query recordset <cfset foo = querynew('column1, column2..., new_img_column')
3. loop over the real query's records transferring the info to the other one AND stuffing the html for the image in the new_img_column. (make sure to keep your quote marks in line)
4. send your new homemade query to the html grid.

It's ugly but works.  I used it to add an "option" grid column that contained links to edit/delete the data in that row.

You could put <a href='javascript: void(0);' onclick='pop_window(db_key);'>#img_name#</a> in the fake column discussed above.

You would need a JS function pop_window in the appropriate place on the page.
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 33701510
Thank you.
if i will have problems i will come back
regards
panos
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question