Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Reload a open modal #1379


User avatar
0
montanaprogrammer created

I have a modal that has a select form field in it that is populated from the database; it also has a button that opens another modal where the user can add a new record to the database, once they add the record I need to refresh the modal that has the select so that the newly created option appears in the select list.

The select list is populated using a ViewBag parameter that is set in the Controller, thus the need to "refresh/reload" the modal window (to get the newly added record)

is there a "refresh" or "reload" method for the first open modal?


3 Answer(s)
  • User Avatar
    0
    montanaprogrammer created

    I was able to resolve this using the existing

    _resetUserSpecificPermissions()
    

    in _PermissionsModal.js

    as an example, tweaking it to my specific need!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think it's better to get your data with an ajax request. That way, you can easily refresh only the select list.

  • User Avatar
    0
    montanaprogrammer created

    I do agree AJAX request is best approach, and that is how I am doing it in numerous other locations. I just needed a fix for this one instance as it would have been a lot more work to refactor the modal to use AJAX for the select list, then it was to implement the refresh of the initial modal when the secondary modal executed a save.