Highlighting a row that has an empty value in it.
Highlighting a row that has an empty value in it.
hazardousfrogwill
Posts: 2Questions: 0Answers: 0
Im making a table that shows a live feed of data being entered in a system. I would like the table to flag red if a field has been missed. How can I highlight a row that has empty value in one of its columns?
This is my javascript
[code]
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"sAjaxSource": 'ajax.cfc?method=getData'
} );
$('#example tbody tr').live('click', function () {
var sMsg;
var nTds = $('td', this);
var sFormID = $(nTds[0]).text();
var sTitle = $(nTds[1]).text();
var sFirst = $(nTds[2]).text();
window.open('update.cfm?form_id='+sFormID+'', 'Update Details', 'width=350, height=350'); return false;
});
setInterval(refreshData,1000);
} );
function refreshData()
{
oTable.fnReloadAjax();
}
[/code]
This is my HTML
[code]
Form ID
Title
First Name
Surname
Email
[/code]
Thanks in advanced for any help!
This is my javascript
[code]
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"sAjaxSource": 'ajax.cfc?method=getData'
} );
$('#example tbody tr').live('click', function () {
var sMsg;
var nTds = $('td', this);
var sFormID = $(nTds[0]).text();
var sTitle = $(nTds[1]).text();
var sFirst = $(nTds[2]).text();
window.open('update.cfm?form_id='+sFormID+'', 'Update Details', 'width=350, height=350'); return false;
});
setInterval(refreshData,1000);
} );
function refreshData()
{
oTable.fnReloadAjax();
}
[/code]
This is my HTML
[code]
Form ID
Title
First Name
Surname
[/code]
Thanks in advanced for any help!
This discussion has been closed.
Replies
Added
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if(aData[1]=="" || aData[2]=="" ||aData[3]=="" || aData[4]==""){
nRow.className = "warn";
}
return nRow;
}
[/code]