0

This is my code:

<?php
require_once '../../../jq-config.php';
// include the jqGrid Class
require_once ABSPATH."php/jqGrid.php";
// include the driver class
require_once ABSPATH."php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
/    / Tell the db that we use utf-8
$conn->query("SET NAMES utf8");

// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT p.product_id, p.product_title, p.product_image1_t2, pc.product_cat_name, b.brand_name FROM ' . DB_PRODUCTS .'  p INNER JOIN ' . DB_PRODUCT_CATS . ' pc ON p.product_cat_id=pc.product_cat_id LEFT JOIN ' . DB_BRANDS . ' b ON b.brand_id=pc.product_cat_brand_id';
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model from SQL query
$grid->setColModel();
// Set the url from where we obtain the data
$grid->setUrl('grid.php');
// Set alternate background using altRows property
$grid->setGridOptions(array(
    "rowNum"=>10,
    "sortname"=>"product_id",
    "rowList"=>array(10,20,50),
    "height"=>'auto',
    "grouping"=>true,
    "groupingView"=>array(
        "groupField" => array('brand_name'),
        "groupColumnShow" => array(true),
        "groupText" =>array('<b>{0}</b>'),
        "groupDataSorted" => true

    ) 
    ));
// Change some property of the field(s)
$grid->setColProperty("product_id", array("label"=>"NO", "width"=>60));
$grid->setColProperty("brand_name", array("label"=>"BRAND"));
$grid->setColProperty("product_title", array("label"=>"PRODUCT NAME"));
$grid->setColProperty("product_cat_name", array("label"=>"CATEGORY"));
$grid->setColProperty("product_image1_t2", array("label"=>"PRODUCT PHOTO"));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
?>

So, I get my whole data succesfully but, when i call this file I see in "product_image1_t2" (PRODUCT PHOTO) grid just my file's name for example : "image_file.jpg". I want to show the image something like what that shows

<img src="myfile.jpg" alt="my_file.jpg" />

Already check the manual but dont understand, so i'm a newbie on jquery...

Can u help me on this example how to do that? Here you can see the current result:

http://oi55.tinypic.com/11qolsz.jpg

dr.linux
  • 752
  • 5
  • 15
  • 37

1 Answers1

0

Check out the JQGrid forum, there are several threads discussing how to integrate images in the grid, like this one or here on SO, image column in jqGrid?

Community
  • 1
  • 1
fvu
  • 32,488
  • 6
  • 61
  • 79