Jquery easyui 将前台数据根据后台数据进行转换

转载自:点击打开链接

[html]  view plain  copy
  1. function formatProPic(val, row) {  
  2.        return "<img width=80 height=110 src='../" + val + "'>";  
  3.    }  
  4.    function formatStatus(val, row) {  
  5.        if (row.status == 1)  
  6.            return "<div style='color:red;'>已上架</div>";  
  7.        else  
  8.            return "<div style='color:gray;'>未上架</div>";  
  9.    }  
[html]  view plain  copy
  1. <th field="path" width="100" align="center" formatter="formatProPic">图片</th>  
[html]  view plain  copy
  1.  <th field="status" width="55" align="center"  
  2.             formatter="formatStatus">上架状态  
  3.         </th>  
[html]  view plain  copy
  1. ---------------------------------------------------------------------------  
[html]  view plain  copy
  1.  function formatHref1(val, row) {  
  2.         return "<a href='${pageContext.request.contextPath}/article.html?id=" + row.id + "' target='_blank'>查看详情</a>";  
  3.     }  
[html]  view plain  copy
  1. <th field="content" width="70" align="center"  
  2.             formatter="formatHref1">操作  


[html]  view plain  copy
  1. formatDateTime : function(val,row){  
  2.         var now = new Date(val);  
  3.         return now.format("yyyy-MM-dd hh:mm:ss");  
  4.     },  
  5.     // 格式化连接  
  6.     formatUrl : function(val,row){  
  7.         if(val){  
  8.             return "<a href='"+val+"' target='_blank'>查看</a>";            
  9.         }  
  10.         return "";  
  11.     },  
  12.     // 格式化价格  
  13.     formatPrice : function(val,row){  
  14.         return (val/1000).toFixed(2);  
  15.     },  
  16.     // 格式化商品的状态  
  17.     formatItemStatus : function formatStatus(val,row){  
  18.         if (val == 1){  
  19.             return '正常';  
  20.         } else if(val == 2){  
  21.             return '<span style="color:red;">下架</span>';  
  22.         } else {  
  23.             return '未知';  
  24.         }  
  25.     },  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值