Safari
Safari

Reputation: 11935

jQuery Tablesorter change values or style of a row

I have a question about jQuery tablesorter plugin.

I have a table similar to this (Tablesorter jQuery).

I would to write a javascript function that I can change the cell values of a particular row. for example, we can suppose that we have a row similar to this:

 ========= ========= ========= =========
| Column1 | Column2 | Column3 | Column4 |
 ========= ========= ========= =========
| Value1A | Value1B | Value1C | Value1D |
 --------- --------- --------- ---------
| Value1A | Value1B | Value1C | Value1D |
 --------- --------- --------- ---------
| Value1A | Value1B | Value1C | Value1D |
 --------- --------- --------- ---------
| Value1A | Value1B | Value1C | Value1D |
 --------- --------- --------- ---------

So, I would to write a javascript function similar to:

function changeValues(index_row)
{
 ///Code to change the values (or the style) of the row at index: index_row
}

How can I make this?

Upvotes: 0

Views: 267

Answers (1)

Fiambre
Fiambre

Reputation: 1979

Yes you can:

function changeValues(index_row)
{
 //SELECT TR BY INDEX
 $TR = $("#TABLE_ID > tbody > tr").eq(index_row);
 //EDIT YOUR TD's
 $TR.find("td:eq(0)").html(VALUE);
 $TR.find("td:eq(1)").html(SECOND_VALUE);
 //...
}

Upvotes: 2

Related Questions