gpt4 book ai didi

基于每行输入的 CSS 颜色表

转载 作者:行者123 更新时间:2023-11-28 03:15:07 24 4
gpt4 key购买 nike

是否可以根据每行特定列中的输入为每个表格行着色?

例如,如果:
B1 = 1//红行
B2 = 1//红行
B3 = 3//蓝行
B4 = 2//绿行
B5 = 1//红行

等等?这是一个数据表,会自动将新行填充到表中,这些也应该在系统之后着色。

最佳答案

Demo

    var dataSet = [['Dadar', 'lmsSenitaD', 'Atul salaskar', '9876543210', '', 'Not Joined', '10/01/2014', '', 'Come back and Join', 'Mobile', 'Times','1'],
['Aundh', 'Rashmi', 'Preeti Gupta', '9876543210', '', 'Not Joined', '10/01/2014', '', 'Will Discuss with Family', 'Online Campaign', 'Iksula','2'],
['Do@Home_Thane', 'Rashmi', 'Mitali Gupta', '9876543210', '', 'Joined - Old Date', '10/01/2014', '20/08/2014', 'Come back and Join', 'Online Campaign', 'Iksula','4']];

$(document).ready(function () {
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');

$('#example').dataTable({
"data": dataSet,
"columns": [
{ "title": "Center" },
{ "title": "Call Executive" },
{ "title": "Name" },
{ "title": "Mobile" },
{ "title": "Phone" },
{ "title": "Status" },
{ "title": "Appt Date" },
{ "title": "Joined Date" },
{ "title": "Remark" },
{ "title": "Source" },
{ "title": "Publisher" },
{ "title": "css" },
]
,
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
var css = aData[aData.length - 1];
if (css == "1") {
$(nRow).addClass('gradeN');
}
else if(css == "2") {
$(nRow).addClass('gradeC');
}
else{
$(nRow).addClass('gradeM');
}

}

关于基于每行输入的 CSS 颜色表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45515066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com