easyUI datagrid显示图片的有关问题
easyUI datagrid显示图片的问题
数据库中存放的是图片的路径(shos_pic),该怎么显示在easyui 表格中呢?
------解决方案--------------------
楼主去认真看下api,formatter就是格式化数据为你需要的显示各使用的
http://www.jeasyui.com/documentation/index.php
------解决方案--------------------
比如这列是图片的地址,要显示图片 ,
<th data-options="field:'shoes_picture',formatter:showImg"width="120" ><strong>SHOES_PIC</strong></th>
JS:
function showImg(val,row){
return '<img src='+val+'/>';
}
数据库中存放的是图片的路径(shos_pic),该怎么显示在easyui 表格中呢?
<table id="d_day_pTOP" class="easyui-datagrid" style="width:auto;height:auto" title="Daily_Sales_TopShoes"
pagination='true' data-options=" pagination:true, url: 'get_top20product.php', singleSelect: true, rownumbers:true "
>
<thead>
<tr>
<th field="classname8" width="80" ><strong>SEASON</strong></th>
<th field="colthno" width="120" ><strong>PRODUCT CODE</strong></th>
<th field="shoes_picture" width="120" ><strong>SHOES_PIC</strong></th>
<!-- http://www.jkjyfashion.com/photo/collection/1376897034.jpg'> -->
<th field="nos_nb" width="120" ><strong>TRANSACTION</strong></th>
<th field="nb" width="120" ><strong>QUANTITY</strong></th>
<th field="amt" width="120" ><strong>SALES(VAT)</strong></th>
<th field="amt_per" width="120" ><strong>% OF TOTAL</strong></th>
</tr>
</thead>
</table>
------解决方案--------------------
楼主去认真看下api,formatter就是格式化数据为你需要的显示各使用的
http://www.jeasyui.com/documentation/index.php
------解决方案--------------------
比如这列是图片的地址,要显示图片 ,
<th data-options="field:'shoes_picture',formatter:showImg"width="120" ><strong>SHOES_PIC</strong></th>
JS:
function showImg(val,row){
return '<img src='+val+'/>';
}