Solved

cfgrid-show image

Posted on 2010-09-16
5
660 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now