【发布时间】:2015-03-27 12:23:57
【问题描述】:
我在 angularjs 中使用数据表在表格中显示产品列表。 通过使用 mData 我可以将值绑定到列,但是在尝试使用 mRender 时它返回错误。
<table ui-jq="dataTable" ui-options="{
sAjaxSource: 'http://www.server.netshell:3001/product/getMyProductsList',
aoColumns: [
{ mData: null,sDefaultContent: '' },
{ mData: 'productname' },
{ mData: 'published' },
{ mData: 'condition' },
{ mData: 'type' },
{ mData: 'category' },
{ mData: 'price'},
{ mData: null, sDefaultContent: ''},
{ mRender: function(data, type, val){
return data.productID;
}}
]
}" class="table table-striped b-t b-b" id="pTable">
<thead>
<tr>
<th style="width:20%">Product ID</th>
<th style="width:20%">Product Name</th>
<th style="width:25%">Status</th>
<th style="width:25%">Condition</th>
<th style="width:15%">Type</th>
<th style="width:15%">Category</th>
<th style="width:15%">Price</th>
<th style="width:15%">Added</th>
<th style="width:15%">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
在这里,我正在尝试获取 ProductId 并将该 ID 发送到我的控制器以进行 Edit 或 Delete onclick。但是当尝试在该列中显示简单的 productId 时,它返回了一个错误
看起来像语法错误,但找不到我错过的地方!
有人可以帮我解决这个问题吗? 参考: Datatables mData
【问题讨论】:
标签: jquery angularjs datatables jquery-datatables