Git Product home page Git Product logo

Comments (4)

wenzhixin avatar wenzhixin commented on June 12, 2024

The cellStyle column option can do what you want: https://live.bootstrap-table.com/code/wenzhixin/17286.

from bootstrap-table.

bounlu avatar bounlu commented on June 12, 2024

Thanks @wenzhixin

However your example does not work for me. I need cellStyle function to remember the previous row and check if any value has changed. In your case, you input the values or index yourself.

from bootstrap-table.

wenzhixin avatar wenzhixin commented on June 12, 2024

Maybe you can save the previous row to the current row for check.

from bootstrap-table.

bounlu avatar bounlu commented on June 12, 2024

Ok I achieved this without cellStyle attribute with the below function (thanks to ChatGPT haha):

var tableVersionHistory = $('#tableVersionHistory');
var rowCount = tableVersionHistory.find('tr').length;

for (var rowIndex = rowCount - 2; rowIndex > 0; rowIndex--) {
    tableVersionHistory.find('tr:eq(' + rowIndex + ') td:not(:last-child)').each(function(cellIndex) {
        var currentValue = $(this).text();
        var nextRowValue = tableVersionHistory.find('tr:eq(' + (rowIndex + 1) + ') td:not(:last-child)').eq(cellIndex).text();
        if (currentValue !== nextRowValue) {
            $(this).css('background-color', 'yellow');
        }
    });
}

from bootstrap-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.