Open Closed

Return Success Alert When use Modal #3696


User avatar
0
thaithiendi created

Dear support Team,

I want to return An success alert when created entity successfuly. I use OnPostAsync action on Modal and AbpModalButtons.Save

  • ABP Framework version: v5.3.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

2 Answer(s)
  • User Avatar
    1
    berkansasmaz created
    Support Team .NET Developer

    Hi,

    You can listen to the onResult event for this.

    See: https://docs.abp.io/en/abp/5.2/UI/AspNetCore/Modals#saving-the-modal

    Where you open the create modal, you can listen to the modal's onResult event by using the modal's variable (for instance: productCreateModal) like below:

    productCreateModal.onResult(function(){
         console.log(arguments);
         // check response and show a message if the response is successful.
         abp.message.success(l('CreateProductSuccessMessage'))
                    .then(data => window.location.href = "/Products");
    });
    
  • User Avatar
    0
    thaithiendi created

    Thanks berkansasmaz , It's really helpful for me.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11