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

Question

Question

Identifying the index of the row that was deleted from the Collection using the 'X' (on Prem)

asked on December 5, 2022

Hello,

I created a form with a Collection and a Table and tried to Add/Delete records to/from both, trying to catch the Add/Delete events in Javascript for further processing.

All seems to work well except for the Deletion from the Collection. To solve this, we moved the cf-collection-delete check under the cf-collection-append check and it seems to work now.

But the problem I am having is in identifying the index of the row that I deleted from the Collection. Please can someone show me how to identify which row I delete from the Collection.

$(document).ready( function() {

    console.log('begin..');
  
//collection  (Add and Delete rows)
    $('.collection_class').on('click','.cf-collection-append',function(){
      console.log('coll add clicked..');
       $('.cf-collection-delete').on('click',function(){
      console.log('coll del pressed..');
  				});
  });

  //table
    $('.table_class table').on('click','.cf-table-append',function(){
      console.log('table add clicked..');
  });
  //doesn't work
  
  //table delete
    $('.table_class table').on('click','.cf-table-delete',function(){
      console.log('table delete clicked..');
  });

 //table add  
  	$('#q10').on('click', function() {
      console.log('table add clicked2..');
    });

});

 

 

 

Thanks.

Sam.

0 0

Replies

replied on January 4, 2023

Hi Samsudeen,

The index can be retrieved like this:

console.log('coll del pressed..' + $('.cf-collection-delete').index(this));

 

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

Sign in to reply to this post.