Null Pointer
Null Pointer

Reputation: 9289

change content of a cell using row id

I am generating a table. The table having a check box columns to select rows.Each row have a column named status . While clicking a button on the page i want to update the status column to 'working' using jquery.

I get the selected row id using jquery in button click event using jquery

  $('#BttnChangeStatus').click(function () {
         var selectedCalls = [];
         $('#result_table :checked').each(function () {
             selectedCalls.push($(this).val()); //the row id and value of check box are same
            //need to update status to working'.. how can i do this

         });

How can i update status column??

Upvotes: 0

Views: 2467

Answers (3)

Mark Coleman
Mark Coleman

Reputation: 40863

Not knowing anything about your markup..

$('#result_table :checked').each(function () {
  selectedCalls.push($(this).val()); //the row id and value of check box are same
  $("#" + $(this).val()).find("td:eq(3)").text("Working...");
});

Where $("#" + $(this).val()) will give you the current row. and td:eq(3) will get your the td cell at index 3. From there you should simply be able to change the text.

Code example on jsfiddle.

Upvotes: 1

RameshVel
RameshVel

Reputation: 65877

Try this

 $('#rowid').find('#columnid').text('working') or
 $(this).find('#columnid').text('working')

Upvotes: 2

Eugene msc
Eugene msc

Reputation: 380

if status column doesn't have any identifier then

    $('#result_table :checked').parents('tr').children('td:eq(x)').text("working...");

where x is the number of status column in your table.

Upvotes: 3

Related Questions