jQuery的datatable怎么才能给某一列添加超链接?

aocolumeDef.这个里面去定义.return返回的字符串会代替原来cell里面的内容
 
e.g:
datatable=$('#dt_basic').dataTable({
             "bAutoWidth": false,
             "bStateSave":true,
                "sPaginationType": "bootstrap_full",
                "sAjaxSource":url,
                "sAjaxDataProp": "poolList",
                "aoColumns": [{ "sTitle":"ID", "mDataProp": "poolId","sClass":"center"},
                              { "sTitle":"存储池名称", "mDataProp": "poolName","sClass":"center"},
                              { "sTitle":"运行状态", "mDataProp": "status","sClass":"center"},
                              { "sTitle":"缓存状态", "mDataProp": "iscache","sClass":"center"},
                              { "sTitle":"总容量", "mDataProp": "diskPack.poolSize","sClass":"center"},
                              { "sTitle":"使用率", "mDataProp": "diskPack.usage" ,"sClass":"td-progress center"},
                              { "sTitle":"操作","mDataProp": "objectId","sClass":"center"},
                              { "sTitle":"创建时间", "mDataProp": "createTime","sClass":"center"}
                              ],
                "aoColumnDefs":[{"aTargets":[6],"mRender":function(data,type,full){
                     return "<a href=\"#myModal-edit\" data-toggle=\"modal\" οnclick=\"preUpdate('"+data+"')\"> <i class=\"fa fa-lg-2 fa-pencil\"> </i> </a>     <a href=\"javascript:void(0)\" data-toggle=\"modal\" class=\"smart-mod-eg1\" οnclick=\"delPool('"+data+"',event)\"> <i class=\"fa fa-lg-2 fa-trash-o\"> </i> </a>    "}
                    },
                    {"aTargets":[5],"mRender":function(data,type,full){
                     return data+"%<div class=\"progress\"><div aria-valuetransitiongoal=\""+data+"\" class=\"progress-bar bg-color-teal\" style=\"width: "+data+"%;\" aria-valuenow=\""+data+"\"> </div></div>";
         }

},
                    {"aTargets":[2],"mRender":function(data,type,full){
                     if(data=='2'){
                      return "维护";
                     }else{
                      return "运行";
                     }
                       }
                       }, 
                        
                       {"aTargets":[3],"mRender":function(data,type,full){
                        if(data=='1'){
                         return "是";
                        }else{
                         return "否";
                        }
                            
                          }
                          },
                          {"aTargets":[0],"mRender":function(data,type,full){
                           return data+"  <a href=\"#myModal-file\" data-toggle=\"modal\" οnclick=\"viewpool('"+full.objectId+"',event)\"> <i class=\"fa fa-lg-2 fa-file-o \"></a>";
                          }
                          }
                      ]
            });

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值