How to highlight a newly added row without disturbing pagination and sorting.

How to highlight a newly added row without disturbing pagination and sorting.

ArunadeviArunadevi Posts: 2Questions: 1Answers: 0
edited October 2017 in Free community support

Hi friends,

I am looking for options to highlight a newly added row. I have pagination and sorting enabled . Sorting happens based on date , name and content description.

For example, When I do sort by name, the newly added row can go in between existing rows and on a different page number . But I need to highlight that newly added row with right pagination.

I am not using the built in add function , due to specific project need. Hence cannot avail this functionality in data table.

Please give me some idea on how to highlight the row everyone when it is added.

Answers

  • ArunadeviArunadevi Posts: 2Questions: 1Answers: 0

    Friends , Any inputs to this is welcome.

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    try taking a look at the row callback function and add a class to the css

    https://datatables.net/reference/option/rowCallback

    rowCallback: function ( row, data, index ) {
    
            if ( *something to determine new row*) { //highlights the row
                $('td', row).addClass('lightred');
            } else {
                $('td', row).removeClass('lightred');
            }
        }
    
This discussion has been closed.