Detect delete on datatable

Hi,
I am trying to detect when user deletes information on datatable. I want to save the deleted data row in a separate field when user deletes that data. I tried adding event listeners on 'k-grid-delete' and 'k-button-icontext' but without success.
What i am trying to achieve is this:

fd.control('DelegatesTable').$on('delete', function(value){
        fd.field('DeletedPerson').value = value.DelegateUid;
})

**DelegateUid is the first colomn on my DataTable:

I could not find any documentation or questions so any help would be appreciated.

Thanks in advance :slight_smile:

Dear @asmita_adh,
Try this:

fd.rendered(function () {
    var length = fd.control('DataTable1').length;
    fd.control('DataTable1').$on('change', function(value) {
        if(length > value.length){
            console.log('Delete');
        }
        else if(length < value.length){
            console.log('Add');
        }
        length = value.length;
    });
});

Hi @Nikita_Kurguzov ,

Thank you for your response but it seems like its not really steady... For example it gets fired even when the length > value.length! :face_with_spiral_eyes:
This is my code:

 var length = fd.control('PGOtherDtTable').value.length;
    fd.control('PGOtherDtTable').$on('change', function(value){
        console.log('****Before:', 'length:', length, 'value.length:', value.length);
        if(length > value.length) DeleteFromOthersField(value);
        length = value.length;
        console.log('****After:','length:', length, 'value.length:', value.length);
    });
function DeleteFromOthersField(data){
    MyLogging('Here??', data);
}

As you can see in the console: Even when I am adding data, my Delete function gets triggered:
image

Could you please look and help me further? Thanks in advance

Dear @asmita_adh,
I see that it only triggered after you removed an item, and the length got less:
image

In the first line value length was 1, it then triggered delete, and the value is 0, meaning it was deleted.

Other times don't seem to trigger delete from this log.