本文介绍了fnRender在数据表中给出问题? mvc4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下提到的代码运行良好但是当我尝试使用fnRender只是为了使它超链接并且它抛出我**在编辑时不能更新(服务器错误)**。
我的代码:
well the below mentioned code works good but when i am trying using fnRender just to make it hyperlink and its throwing me **CELL CANNOT BE UPDATED (SERVER ERROR)** while editing .
My code :
<script type="text/javascript">
$(document).ready(function () {
$.datepicker.regional[""].dateFormat = 'dd/mm/yy';
$.datepicker.setDefaults($.datepicker.regional['']);
var tab= $('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'AjaxDataProvider',
"bJQueryUI": true,
"aoColumns": [
{
"sName": "ID",
"bSearchable": false,
"bSortable": false ,
"fnRender": function (oObj) {
return '<a href=\"Home/Details/' + oObj.aData[0] + '\">View</a>';
}
},
{ "sName": "COMPANY_NAME" },
{ "sName": "ADDRESS" },
{ "sName": "TOWN" }
]
});
tab.columnFilter({
sPlaceHolder: "head:after",
aoColumns: [
{
type: "date-range",
bRegex: true,
bSmart: true
},
{
type: "number-range"
},
{ type: "text" },
{ type: "text" }
]
});
tab.makeEditable({
"aoColumns": [
null,
null,
null,
{
indicator: 'Saving...',
tooltip: 'Click to select town',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
loadurl: 'AjaxDataProvider1'
//data: "{'London':'London','Liverpool':'Liverpool','Portsmouth':'Portsmouth','Edinburgh':'Edinburgh', 'Blackburn':'Blackburn','Kent':'Kent','Essex':'Essex','Oxon':'Oxon','Lothian':'Lothian','West Sussex':'West Sussex','Lanarkshire':'Lanarkshire','Birmingham':'Birmingham','East Sussex':'East Sussex','Surrey':'Surrey'}"
}]
});
});
</script>
}
<table id="myDataTable" class="display">
<thead>
<tr>
<th>ID</th>
<th>Company name</th>
<th>Address</th>
<th>Town</th>
</tr>
<tr>
<th>ID</th>
<th>Company name</th>
<th>Address</th>
<th>Town</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th>ID</th>
<th>Company name</th>
<th>Address</th>
<th>Town</th>
</tr>
</tfoot>
</table>
欢迎任何建议
问候
Any suggestions are welcome
Regards
推荐答案
这篇关于fnRender在数据表中给出问题? mvc4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!