0

これは私のコードです:

<?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;
?>

したがって、データ全体を正常に取得できますが、このファイルを呼び出すと、「product_image1_t2」(製品写真)グリッドに「image_file.jpg」などのファイル名だけが表示されます。それが示すもののような画像を表示したい

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

すでにマニュアルを確認していますが、理解していないので、jqueryの初心者です...

この例でそれを行う方法を教えてもらえますか? ここで、現在の結果を確認できます。

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

4

1 に答える 1

0

JQGridフォーラムをチェックしてください。このような、またはここSOのjqGridの画像列のように、画像をグリッドに統合する方法を議論するスレッドがいくつかありますか?

于 2011-08-23T22:42:50.983 に答える