Javascript jQuery datatable-更改单元格值
我希望有人能帮我解决这个问题。 我正在研究一个旧版本datatables.net的遗留应用程序 它使用函数填充datatable,并根据返回的名称为行添加颜色。 下面的代码可以工作Javascript jQuery datatable-更改单元格值,javascript,jquery,datatables,jquery-datatables,Javascript,Jquery,Datatables,Jquery Datatables,我希望有人能帮我解决这个问题。 我正在研究一个旧版本datatables.net的遗留应用程序 它使用函数填充datatable,并根据返回的名称为行添加颜色。 下面的代码可以工作 $(function () { $("#ProfileTable").dataTable({ "bProcessing": true, "bServerSide": true, "bFilter": false, //Hide the search box "bInfo": fals
$(function () {
$("#ProfileTable").dataTable({
"bProcessing": true,
"bServerSide": true,
"bFilter": false, //Hide the search box
"bInfo": false,
"bPaginate": false,
"bLengthChange": false,
"sAjaxSource": 'DataTableHandler.ashx?dataTableId=ProfileTable',
"aoColumns": [ //aoColumns defines the properties of the table columns
{
"mDataProp": "Name",
"fnRender": function (o) {
return SetToolTip(o);
}
},
{
"mDataProp": "DollarValue",
"fnRender": function (o) {
return accounting.formatMoney(dollarValue);
}
,
"bUseRendered": false,
"sClass": "dataTableTextAlignRight"
}
],
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
//Highlight the row colors based on the Name. It must be identical to what is being retrieved from the database
var columnData = aData["Name"];
var div = document.createElement("div");
div.innerHTML = columnData;
if (div.innerText == "TOYS" {
$('td', nRow).css('background-color', '#E0E0E0');
}
if (div.innerText == "LOST TOYS" ) {
$('td', nRow).css('background-color', '#BDBDBD');
}
}
}
我遇到的问题是:如果Name=“LOST TOYS”和DollarValue=0,则将DollarValue更改为显示为空字符串(即单元格中不显示任何值)
我已经研究过如何使用FNDUpdate,但我无法让它读取正确的行和列。它以“未定义”返回
如有任何建议,我们将不胜感激。
谢谢 我脑子里放了个屁。
代码转到服务器端以获取数据
以下是信息链接: