Slow work of coloring of rows
Slow work of coloring of rows
Hi all.
I have MySQL base which consists of 1500 entries. I want to make different color of rows and do it like this:
[code]"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if(aData[1].search("black")>-1){
$(nRow).addClass("black");
}[/code]
But the problem is that it is so slow and my base loads only when I select to show no more than 100 entries.
What i should do to make my table more fast? :)
I have MySQL base which consists of 1500 entries. I want to make different color of rows and do it like this:
[code]"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if(aData[1].search("black")>-1){
$(nRow).addClass("black");
}[/code]
But the problem is that it is so slow and my base loads only when I select to show no more than 100 entries.
What i should do to make my table more fast? :)
This discussion has been closed.
Replies
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if (aData[1]=="black") {nRow.className = nRow.className + "black"}
if (aData[1]=="yellow") {nRow.className = "yellow"}
if (aData[1]=="red") {nRow.className = "red"}
if (aData[1]=="green") {nRow.className = "green"}
},
[/code]
Yeah. I made it ;)
I want to make class of row "even black". Now I have the class like this only for black, other classes look like " green", " yellow"... What I should do?
[code]
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if (aData[1]=="black") {nRow.className = nRow.className + " black"}
else if (aData[1]=="yellow") {nRow.className = nRow.className + " yellow"}
else if (aData[1]=="red") {nRow.className = nRow.className + " red"}
else if (aData[1]=="green") {nRow.className = nRow.className + " green"}
},
[/code]