Collectionview - cancelRemove

Posted by: mary431982 on 15 June 2022, 7:47 pm EST

  • Posted 15 June 2022, 7:47 pm EST

    Hello,

    I removed a row from collectionview, but after trying to save that change to the DB - the DB refused to delete it. So now I need to cancel that removement from the collectionview - BUT unlike cancelEdit and cancelNew - for removement there is no method cancelRemove. I’ve tried to add the removed item manually to collection items, but it didn’t work.

    Help!!! What should I do?

  • Posted 20 June 2022, 3:11 pm EST

    Hello,

    We apologize for the delayed response, you may refer to the sample link below demonstrating how you can store the deleted item and restore it later on(in case of DB refuse to save the changes):

    https://stackblitz.com/edit/js-ffrgal?file=index.js

    Regards

  • Posted 23 June 2022, 6:26 pm EST

    Thanx.

    I figured it out that the key is to change the SourceCollection and not the collectionView.

    But, is there a way with less code? Why there isn’t a function cancelRemove (like there are functions cancelEdit and cancelNew)?

    Regards

  • Posted 26 June 2022, 11:39 pm EST

    Hello,

    No, but there isn’t any inbuild function like cancelRemove in CollectionView or FlexGrid. The provided methods like cancelEdit and cancelNew are as per the most generic use cases. And to handle the specific use case scenarios like yours you can easily implement it using the above-shared approach. Let us know if you face any issues with the above-shared approach.

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels