【发布时间】:2014-11-06 12:40:24
【问题描述】:
我正在尝试使我的 JQuery 数据表中的一列显示链接,如下面的代码所示,但我总是收到错误,并且根本没有显示任何内容。有人可以通过指出我到底做错了什么以及如何正确地将数据表列之一中显示的数据更改为链接来提供帮助吗?谢谢
<div class="table-responsive">
<table ui-jq="dataTable" ui-options="{
data: dset,
aoColumns: [
{ mData: 'title' },
{ mData: 'firstName' },
{ mData: 'lastName' },
{ mData: 'email' }
],
"aoColumnDefs": [ {
"aTargets": [ 3 ],
"mRender": function ( data, type, full ) {
return '<a href="/mailto/' + full[3] + '">' + data + '</a>';
}
}
]
}" class="table table-striped m-b-none">
<thead>
<tr>
<th style="width:15%">Title</th>
<th style="width:30%">First Name</th>
<th style="width:30%">Last Name</th>
<th style="width:25%">Email</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
注意:dset 返回:
[{"_id":"543e58b862744980197026a8","title":"Mr.","firstName":"Michael","lastName":"A","email":"michael@gmail.com","address":"New York","password":"123456","activeMember":true,"__v":0,"role":"Member","memberSince":"2014-10-15T11:21:28.884Z"},{"_id":"543e591862744980197026a9","title":"Ms","firstName":"Mary","lastName":"W","email":"mary@gmail.com","address":"New York","password":"123456","activeMember":true,"__v":0,"role":"Admin","memberSince":"2014-10-15T11:23:04.382Z"}]
- 我还在我的 AngularJS 应用中实现上表。
我看到的错误是:
Error: [$parse:syntax] Syntax Error: Token 'undefined' is unexpected, expecting [:] at column null of the expression [[{
data: dset,
aoColumns: [
{ mData: 'title' },
{ mData: 'firstName' },
{ mData: 'lastName' },
{ mData: 'email' }
],]] starting at [[{
data: dset,
aoColumns: [
{ mData: 'title' },
{ mData: 'firstName' },
{ mData: 'lastName' },
{ mData: 'email' }
],]].
【问题讨论】:
标签: jquery angularjs datatable