Solved

cfgrid-show image

Posted on 2010-09-16
5
676 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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 …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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