Json 在Alloy UI数据表中显示链接

Json 在Alloy UI数据表中显示链接,json,alloy-ui,Json,Alloy Ui,我想在alloy ui数据表中添加超链接。下面是我的代码 <head> <link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet"></link> <script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script> <scr

我想在alloy ui数据表中添加超链接。下面是我的代码

<head>
    <link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>
    <script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script>
    <script>
        YUI().use(
          'aui-datatable',
          function(Y) {
            var columns = ['name', 'address', 'city', 'state','edit'];

            var data = [
              {address: '1236 Some Street', city: 'San Francisco', name: 'John A. Smith', state: 'CA', edit:'<a href="www.google.com">Google</a>'},
              {address: '3271 Another Ave', city: 'New York', name: 'Joan B. Jones', state: 'NY', edit:'<a href="www.google.com">Google</a>'},
              {address: '9996 Random Road', city: 'Los Angeles', name: 'Bob C. Uncle', state: 'CA', edit:'<a href="www.google.com">Google</a>'},
              {address: '1623 Some Street', city: 'San Francisco', name: 'John D. Smith', state: 'CA', edit:'<a href="www.google.com">Google</a>'},
              {address: '9899 Random Road', city: 'Los Angeles', name: 'Bob F. Uncle', state: 'CA', edit:'<a href="www.google.com">Google</a>'}
            ];

            new Y.DataTable.Base(
              {
                columnset: columns,
                recordset: data
              }
            ).render('#myDataTable');
          }
        );
    </script>
</head>
<body>
    <div id="myDataTable"></div>
</body>

YUI()使用(
“aui数据表”,
功能(Y){
变量列=[“名称”、“地址”、“城市”、“州”、“编辑”];
风险值数据=[
{地址:'1236 Some Street',城市:'San Francisco',姓名:'John A.Smith',州:'CA',编辑:'},
{地址:'3271另一条大街',城市:'New York',姓名:'Joan B.Jones',州:'NY',编辑:'},
{地址:'9996 Random Road',城市:'Los Angeles',姓名:'Bob C.Uncle',州:'CA',编辑:'},
{地址:'1623某处街道',城市:'旧金山',姓名:'John D.Smith',州:'CA',编辑:'},
{地址:'9899 Random Road',城市:'Los Angeles',姓名:'Bob F.Uncle',州:'CA',编辑:'}
];
新的Y.DataTable.Base(
{
columnset:列,
记录集:数据
}
).render(“#myDataTable”);
}
);
在显示过程中,它将html显示为字符串。如何将其显示为超链接


我认为我们不能在JSON中添加标记标记,但有没有机会完成我的工作。任何帮助都将不胜感激

我认为您可以调整列定义以适应链接

假设您想在
编辑
列下的值上有一个链接,则必须将其定义为:

var columns = [
    'name', 
    'address', 
    'city', 
    'state',
    {
        key: 'edit',
        allowHTML: true // Must be set or the html will be escaped
    }
];

然而,我没有测试过这个。您可以找到有关
数据表格式化程序的更多信息

我认为您可以调整列定义以适应链接

假设您想在
edit
列下的值上有一个链接,则必须将其定义为:

var columns = [
    'name', 
    'address', 
    'city', 
    'state',
    {
        key: 'edit',
        allowHTML: true // Must be set or the html will be escaped
    }
];
然而,我没有测试过这个。您可以找到有关数据表格式化程序的更多信息