Color not applying for the next page in pagination.
Color not applying for the next page in pagination.
Hi Guys,
I'm displaying the data around 1000 records and in onload it's displaying the particular color for particular value.
suppose Value A means Blue and Value B means Green and Value C means Red.
I''m finding the td value and having class called .colorChange for that i'm using the jquery like below.
jQuery('.colorChange:contains("A")').css('color', '#2ecc71');
my entire code is like below
jQuery(document).ready(function () { jQuery(function () { jQuery("#myTable").dataTable({ "destroy": true, "dom": '<"pull-left"f><"pull-right"l>tip', "bSortable": true, "aaSorting": true, "lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]] }); jQuery('.colorChange:contains("A")').css('color', '#2ecc71'); jQuery('.colorChange:contains("B")').css('color', '#3498db'); jQuery('.colorChange:contains("C")').css('color', '#9b59b6'); jQuery('.colorChange:contains("D")').css('color', '#e74c3c'); }) });<td class="colorChange">
@Html.DisplayFor(modelItem => item.Chemicals)
</td>
Please tell me exactly solution on 2nd page and remaining all also colors not applying on load particular value particular color applying.
Please follow the below urls of those images
1) https://s14.postimg.org/qjm70w8dd/image.png
2) https://s12.postimg.org/vmgiqmxv1/image.png
3) https://s17.postimg.org/c6c2ko2u7/image.png
Please give me a solution for above..
Answers
You need to use the DataTables API to get all the rows in the table -
rows().nodes()
for example.Or run your link of colour changing code in
drawCallback
.Allan