simple-datatables
simple-datatables copied to clipboard
Cells loosing added classes after sorting
Hello there!
I init the table using this code
datatable = new DataTable("#orders-table",{
perPage:1000,
perPageSelect:[5,25,100,1000],
});
After a button is clicked, I manipulate all "empty" td and add a class on them
let noOrder = document.getElementsByTagName('td');
for(let i=0;i<noOrder.length;i++){
//if value = -1 then add the class
if(noOrder[i].innerHTML == '-1'){
noOrder[i].classList.add('no-order');
}
}
Everything works fine until here.
After I click any sorting heading, the no-order class is automatically removed for some reason.
I am not sure what I am doing wrong. Is there a way to "save" the state of the datatable after the class addition so that the order works without removing my classes?
hello any solves jet?
Hey @Lvc4 @agaktr ,
yes you need to go through the rowRender
and render
methods if you want to manipulate any html inside the table.