Change styling based on sData and value of cell based on oData.a

Change styling based on sData and value of cell based on oData.a

jelle002jelle002 Posts: 3Questions: 2Answers: 0
edited April 2017 in Free community support

Using DataTables, I post data through an object. I am trying to customize a cell in a DataTable based on 2 different criteria.

To change the CSS I use the ''''fnCreatedCell''': feature. Here I change the css based on the ''''sData'''' value.

I would like to add a criteria, however, and ask to change the cell value if (oData.value == true) is met, but then maintaining the set CSS I have set in the '''fnCreatedCell''''.

I am tryng to avoid in writing extra code outside the dataTable function to determine this before making the table~~~~.

here is my code to show what I want to do,

$(nTd).css('border-left', '0.2vw solid #333333')
if (sData == readyToPlay) {
$(nTd).css('background-color', '#71da71')
$(nTd).css('width', '60px')
} else if (sData == playersCurrentlyPlaying ) {
$(nTd).css('background-color', '#ffffb3')
} else if (sData == playersUnavailable ) {
$(nTd).css('background-color', '#ff8080')
}

AND

if(oData.priority == true){
sData = "priority match"
$(nTd).css('background-color', '#ffffb3')
}

Answers

This discussion has been closed.