You are viewing limited content. For full access, please sign in.

Question

Question

Last row of table deleting no matter which row selected for deletion

asked on May 15 Show version history

Hey Everyone, 

Having an interesting issue.  I have a form where a second table is being populated by a previous table  (it's an education reimbursement form and shows what classes were previously approved vs. what they are currently asking reimbursement for).  Anyways, on the second table, if the user wanted to drop class A and only request reimbursement for Class B and C, class C is being deleted even though I am clicking to delete class A.  

This table is being populated by a table used previously in the form and that is being accomplished with the following JavaScript

$(document).ready(function(){
  var r1 = $('.originalTable .propCount').val();
  
  while($('.duplicateTable .propCount').val() < r1){
    $('.duplicateTable .cf-table-add-row').click();
  };
});

How do I get it so only the row I am wanting to delete is removed and not the last row in the table?

0 0

Replies

replied on May 15

The JavaScript you posted only appears to add rows, so my suspicion is that Calculations are being used to replicate the data from the other table.

If that is the case, then it is actually deleting the correct row, but the indexing of the calculation is pulling the relative row from the other table (i.e., you delete row 1 and row 2 simply becomes row 1 as far as the calculations are concerned).

Assuming that is what's actually happening, you should hide your second table (with the calculations) in the first form. Then, on your second form, remove the calculations; the data will have been saved in the first step so it won't keep updating and causing this issue.

0 0
replied on May 15

That's a great idea Jason.  I'll try it out tomorrow morning. 

0 0
replied on May 16

Another suggestion

Try changing your table to range of rows?

Cheers

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.