a issue about aoColumnDefs

a issue about aoColumnDefs

fanfacefanface Posts: 11Questions: 2Answers: 0
edited December 2018 in Free community support

like the title,my code like this,

    "aoColumnDefs":[
                                {
                                    "targets":5,
                                    createdCell: function(td, cellData, rowData) {
                                        var data = cellData;
                                        if(data == 5){
                                            $(td).parents('tr').children('td').eq(2).attr("class","warning");
                                            $(td).parents('tr').children('td').eq(2).css("text-decoration","line-through");
                                        }else if(data == 4){
                                            $(td).parents('tr').children('td').eq(2).attr("class","success");
                                        }else{
                                            $(td).parents('tr').children('td').eq(2).attr("class","danger");
                                        }
                                    }
                                }
],

when i click the title to order my data,this code seem not working,i need to set a condition to paint my datacell,anyone can help?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @fanface ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.