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

Question

Question

How to call to the "add" function of a table dynamically via JavaScript?

asked on July 18, 2016 Show version history

It is possible add a row in a table without using the "add" button/link?

Please Help.

 

1 0

Replies

replied on July 19, 2016

Easiest thing to do is programmatically trigger a click on the add button with Javascript. If you add a CSS class to your table (MyTable for instance) this should work:

$(document).ready(function(){
  $('.MyTable .cf-table-add-row').trigger('click');
});

 

0 0
replied on July 19, 2016

Thank you, It work smiley

0 0
replied on May 24, 2020

Hi Scott,

 

Can you please assist me to trigger a add button of multiple table.

Currently i am using following code to trigger the add button but it's not triggering.

Code :

for(var j = 1 ; j < rowCount ; j++){
              
                     var test = ".table"+j;
                       $(".table"+j+"").hide();
                       $(test+" tbody tr").remove();
                       $(test+' .cf-table-add-row').trigger('click');
   } 

Can you please help.

 

Regards,

Sudesh..

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

Sign in to reply to this post.