图像未显示在jtable中?

Syed Haziq Hamdani |

我正在从jtable.org使用jtable问题是我的数据库(MySQL)中存储了一个图像,并且我想使用jtable和其他列在网页上显示该图像。所有其他列均正确显示,但图像未显示。这是我的HTML代码:

    <html>
  <head>

    <link href="themes/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/jtable/themes/lightcolor/blue/jtable.css" rel="stylesheet" type="text/css" />

    <script src="scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
    <script src="Scripts/jtable/jquery.jtable.js" type="text/javascript"></script>

  </head>
  <body>
    <div id="PeopleTableContainer" style="width: 960px;"></div>
    <script type="text/javascript">

        $(document).ready(function () {

            //Prepare jTable
            $('#PeopleTableContainer').jtable({
                title: 'Table of people',
                actions: {
                    listAction: 'PersonActions.php?action=list',
                    updateAction: 'PersonActions.php?action=update'

                },
                fields: {
                    PersonId: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    Name: {
                        title: 'Product',
                        width: '20%'
                    },
                    SellingPrice: {
                        title: 'Selling Price',
                        width: '15%',
                    },
                    CostPrice: {
                        title: 'Cost Price',
                        width: '15%',
                    },
                    Remarks: {
                        title: 'Remarks',
                        width: '15%',
                    },
                    Stock: {
                        title: 'Stock',
                        width: '15%',
                    },
                    Pic: {
                        title: 'Image',
                        width: '50%',
                        edit: false
                    }
                }
            });

            //Load person list from server
            $('#PeopleTableContainer').jtable('load');

        });

    </script>

  </body>
</html>

这是我的SELECT查询以及其他功能:

//从数据库获取记录

$result = mysql_query("SELECT * FROM people;");

    //Add all records to an array
    $rows = array();
    while($row = mysql_fetch_array($result))
    {
        $rows[] = $row;
    }

    //Return result to jTable
    $jTableResult = array();
    $jTableResult['Result'] = "OK";
    $jTableResult['Records'] = $rows;
    print json_encode($jTableResult);
Syed Haziq Hamdani |

我想出了另一种方法,如果我们将图像的地址存储在数据库中,而不是简单地用图像的地址(链接)填充我们的列。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章