我有一整列链接可以从数据库中检索出来,如下所示:
https://docs.google.com/viewer?url=www.amada-book.com/uploads/1369072920.zip
如何在网格中的列上显示html标记? 像这样:
< a href=" https://docs.google.com/viewer?url=www.amada-book.com/uploads/1369072920.zip">FILES </a>
所以你看到的唯一一个词是“文件”,而是一个链接。
答案 0 :(得分:2)
您可以在列模型中使用custom formatter
实施例
colModel: [
{
name:'price',
index:'price',
width:60,
align:"center",
editable: true,
formatter:function(cellvalue, options, rowObject){
return '<a href="' + cellvalue + '">FILES </a> '
}
},
]
答案 1 :(得分:0)
试试这个
var myvalue = https://docs.google.com/viewer?url=www.amada-book.com/uploads/1369072920.zip;
您的网格值将类似于"<a href=" + myvalue + ">Files</a>";
答案 2 :(得分:0)
您可以创建一个事件来实现单击列后发生的事情:
$("#gridColumn").click(
function() {
location.href= "https://docs.google.com/viewer?url=www.amada-book.com/uploads/1369072920.zip";
//or this
window.open("https://docs.google.com/viewer?url=www.amada-book.com/uploads/1369072920.zip");
}
);