Davood Hanifi
Davood Hanifi

Reputation: 1274

jquery jtable change row color in Asp.net webform

In jquery jtable, I Want to Change Some Row's color's. For examlpe for rows that have columns with "mineId=1" row color change to red. How Can I perform this Action? for one column :

mineid: {
title: 'mineid',
display: function (data) {
    if(data.record.mineid == 2)
      return '<b style="background-color:red !important; display:block !important;">' + data.record.mineid + '</b>';
    else
      return data.record.mineid;
}

}

But I want for whole row change color.

Upvotes: 1

Views: 2014

Answers (1)

Rasool Ghafari
Rasool Ghafari

Reputation: 4258

you can use this one to apply your style:

recordsLoaded: function (event, data) {
        for (var i in data.records) {
            if (data.records[i].mineid == 2) {
                $('#MineTableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:red !important; color:white !important;");
            }
        }
    }

Upvotes: 4

Related Questions