alternate coloring of rows
alternate coloring of rows
![nischalinn](https://secure.gravatar.com/avatar/826158e33a8ea114b8fe2bcec7628406/?default=https%3A%2F%2Fvanillicon.com%2F826158e33a8ea114b8fe2bcec7628406_200.png&rating=g&size=120)
i've to customize the color of the alternate rows of datatables replacing the default color of the datatables rows. how can I do it??
This discussion has been closed.
Replies
I am using fnAddData() to add rows. Use the following code to get the latest row handler of the table.
I used a global variable rowName.
var oSettings = oTable.fnSettings();
var row = oSettings.aoData[a[0]].nTr;
if(rowName == "ODD")
{
row.className = "io-package-odd";
rowName = "EVEN";
}
else if(rowName == "EVEN")
{
row.className = "io-package-even";
rowName = "ODD";
}
Regards,
Ankit
Data table do it by using :
$(nBody).children('tr:even').addClass( oSettings.asDestroyStripes[0] );
$(nBody).children('tr:odd').addClass( oSettings.asDestroyStripes[1] );
Search for the above code in JS file and instead of passing the 'oSettings.asDestroyStripes[x] ' pass the name of your own class.
Regards,
Ankit
[code]
table.dataTable tr.odd { background-color: #E2E4FF; }
table.dataTable tr.even { background-color: white; }
[/code]
Allan
table.dataTable tr.odd { background-color: #E2E4FF; }
table.dataTable tr.even { background-color: white; }
This change doesnt seem to affect first column in datatables, I can see the new color in other columns.
Can someone please let me know the reason for this issue?
Thanks Barani
[code]
table.dataTable tr.odd .sorting_1 { background-color: #E2E4FF; }
table.dataTable tr.even .sorting_1 { background-color: white; }
[/code]
- zmt -