使用下面的数据表时遇到2个问题;
var otable = $('#tradeList').dataTable({
"bServerSide": true,
"sAjaxSource": serverDataSource,
"bProcessing": true,
"bLengthChange": false,
"iDisplayLength": "15",
"bPaginate": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "TRADENAME" },
{
"sName": "TRADEID",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
// oObj.aData[2] returns the TradeId
if (oObj.aData[2] == "0")
//return "<a href='" + deleteUrl + "?id=" + oObj.aData[2] + "'>Delete</a>";
return "<button onclick=" + dataService.deleteTrade(oObj.aData[2], fnDraw, deleteUrl ) + ")>";
else
return "";
}
}
]
}).makeEditable({
sUpdateURL: updateUrl,
sAddURL: addUrl,
sDeleteURL: deleteUrl
});
删除按钮是可选的。因此,当我不想显示它时,如何停止显示默认的“单击以编辑”文本。我可以看到它来自Jquery库可转换。 我将在一个单独的问题中提出第二个问题。
答案 0 :(得分:0)
要删除“点击编辑”,您必须将属性“占位符”配置为在“可编辑”功能中清空。在你的情况下将是:
var otable = $('#tradeList').dataTable({
"bServerSide": true,
"sAjaxSource": serverDataSource,
"bProcessing": true,
"bLengthChange": false,
"iDisplayLength": "15",
"bPaginate": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{
"sName": "ID",
"bSearchable": false,
"bSortable": false,
"bVisible": false
},
{ "sName": "TRADENAME" },
{
"sName": "TRADEID",
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
// oObj.aData[2] returns the TradeId
if (oObj.aData[2] == "0")
//return "<a href='" + deleteUrl + "?id=" + oObj.aData[2] + "'>Delete</a>";
return "<button onclick=" + dataService.deleteTrade(oObj.aData[2], fnDraw, deleteUrl ) + ")>";
else
return "";
}
}
]
}).makeEditable({
sUpdateURL: updateUrl,
sAddURL: addUrl,
sDeleteURL: deleteUrl,
aoColumns: [
{
placeholder : ""
},
{
placeholder : ""
},
{
placeholder : ""
}
]
});