Highlight one row when adding data
Highlight one row when adding data
Hello,
I need to highlight a row when data is loaded if it meets certain requirments. I am using the following to load data: I am also testing for a certain value (if (carId == carIdtext)). If the condition is true, I need to highlight that row using css. Any assistance would be appreciated.
Regards, Steven
var carIdtext = $("#_CarIdLabel").text();
success: function (data) {
$(data).each(function (key, val) {
var carId = val["CarBrandId"];
var mfr = val["CarManufactureName"];
var car = val["CarBrandName"];
oTable.fnAddData([
val["CarBrandId"],
val["CarManufactureFx"],
val["CarManufactureName"],
val["CarBrandName"]
]);
if (carId == carIdtext) {
}
});
}
I need to highlight a row when data is loaded if it meets certain requirments. I am using the following to load data: I am also testing for a certain value (if (carId == carIdtext)). If the condition is true, I need to highlight that row using css. Any assistance would be appreciated.
Regards, Steven
var carIdtext = $("#_CarIdLabel").text();
success: function (data) {
$(data).each(function (key, val) {
var carId = val["CarBrandId"];
var mfr = val["CarManufactureName"];
var car = val["CarBrandName"];
oTable.fnAddData([
val["CarBrandId"],
val["CarManufactureFx"],
val["CarManufactureName"],
val["CarBrandName"]
]);
if (carId == carIdtext) {
}
});
}
This discussion has been closed.
Replies
[code]
iRow = oTable.fnAddData([
val["CarBrandId"],
val["CarManufactureFx"],
val["CarManufactureName"],
val["CarBrandName"]
]);
if (carId == carIdtext) {
oTable.fnGetNodes(iRow).addClass("classname");
// oTable.fnGetNodes(iRow).css("background-color", "LightPink"); // change to any color you like, or add a class name
}[/code]
Also, I could use .addClass, but not .css. If you have any insight on this, that would help for my notes.
if (carId == carIdtext) {
var rowI = iRow[0];
var nNodesI = oTable.fnGetNodes(rowI);
$(nNodesI).addClass('hilite');
//$(nNodesI).css("color", "red");
//$(nNodes).css("background-color:rgb(15,99,30);");
};
Regards, Steven