Change formatting of cells matching regex
Change formatting of cells matching regex
zxarr
Posts: 12Questions: 1Answers: 0
I'm looking for a way to apply a class to a cell in a table column, if the cell matches a regular expression. I swear I saw this somewhere in the help, but for the life of me, I cannot find it.
I can do this within the json data, by wrapping the text returned in font tags, but I'd rather not have formatting inside the json data.
item
The Status column can have a value of 'Pending', 'Running' or 'Complete'. I'd like to make the text colour Red, Green and Blue respectively, by using various pre-defined classes: .ht_red, .ht_green, .ht_blue
[code]
$('#t_opencases').dataTable(
{
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"sButtonText": "Copy to Clipboard",
"bFooter": false
},
{
"sExtends": "xls",
"sButtonText": "Export to Excel",
"bFooter": false
},
{
"sExtends": "pdf",
"sButtonText": "Export to PDF",
"bFooter": false
}
]
},
"sAjaxSource": "cases.php",
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [
[25, 50, 100, -1],
["25", "50", "100", "All"]
],
"aoColumns": [
{ "sName": "id", "sTitle": "ID", "sWidth": "5%" },
{ "sName": "status","sTitle": "Status" },
{ "sName": "priority","sTitle": "Priority" },
{ "sName": "assignee","sTitle": "Assignee", "sWidth": "12%" },
{ "sName": "created", "sTitle": "Create Date", "sWidth": "16%" },
{ "sName": "owner", "sTitle": "Owner", "sWidth": "12%" }
],
})
.columnFilter({
aoColumns: [
null,
null,
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "Date" },
{ type: "select" },
{ type: "select" }
]
})
});
[/code]
I can do this within the json data, by wrapping the text returned in font tags, but I'd rather not have formatting inside the json data.
item
The Status column can have a value of 'Pending', 'Running' or 'Complete'. I'd like to make the text colour Red, Green and Blue respectively, by using various pre-defined classes: .ht_red, .ht_green, .ht_blue
[code]
$('#t_opencases').dataTable(
{
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"sButtonText": "Copy to Clipboard",
"bFooter": false
},
{
"sExtends": "xls",
"sButtonText": "Export to Excel",
"bFooter": false
},
{
"sExtends": "pdf",
"sButtonText": "Export to PDF",
"bFooter": false
}
]
},
"sAjaxSource": "cases.php",
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [
[25, 50, 100, -1],
["25", "50", "100", "All"]
],
"aoColumns": [
{ "sName": "id", "sTitle": "ID", "sWidth": "5%" },
{ "sName": "status","sTitle": "Status" },
{ "sName": "priority","sTitle": "Priority" },
{ "sName": "assignee","sTitle": "Assignee", "sWidth": "12%" },
{ "sName": "created", "sTitle": "Create Date", "sWidth": "16%" },
{ "sName": "owner", "sTitle": "Owner", "sWidth": "12%" }
],
})
.columnFilter({
aoColumns: [
null,
null,
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "select" },
{ type: "Date" },
{ type: "select" },
{ type: "select" }
]
})
});
[/code]
This discussion has been closed.