Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9943 closed feature (wontfix)

Ui.dialog close API should have a force mode, non cancelable with events

Reported by: aravindbaskaran Owned by: aravindbaskaran
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.4
Keywords: Cc:
Blocked by: Blocking:


Ui.dialog close API should allow close without triggering the beforeClose event.

Case in consideration -

API required to allow closing of dialog in a non-cancellable way when done programmatically.

Change History (5)

comment:1 Changed 9 years ago by aravindbaskaran

Added to GitHub repos. Pull request submitted -

Please take a look.

comment:2 Changed 9 years ago by Scott González

Owner: set to aravindbaskaran
Status: newpending

Why do you need this?

comment:3 Changed 9 years ago by aravindbaskaran

Status: pendingnew

Consider the below case,

  1. There is a modal form to collect input from user.
  2. User can close the dialog by clicking on - "Cancel" or close ui button.
  3. Add a beforeClose listener to check if the user has entered any value.
  4. If user has not entered any value, continue to end. Else go to 5.
  5. Open a modal confirm, informing the user about unsaved data that might be lost. Two actions -
    1. Confirm close and lose data
    2. Cancel and return to form
  6. If A is chosen, close the modal confirm, and call modal form ("close") API
  7. If B is chosen, close the modal confirm

Fiddle link -

Currently after step 7, step 4 is invoked again and keeps looping.

The requirement is to modify the close API to allow force close without firing the before close event.

A similar analogy can be made to that of setting a value to the input programmatically, which doesn't trigger the change event, unless programmatically triggered.

Hope this helps in understanding the need.

comment:4 Changed 9 years ago by Scott González

Resolution: wontfix
Status: newclosed

You can very easily handle this with a flag in your own code instead of adding a flag to the dialog API.

comment:5 Changed 9 years ago by aravindbaskaran

Ah yes. This can be handled in the code. This is like saying $(document).ready() is not required as it can be easily handled by using window.onload.

But this addition will be more useful as part of the API. Helps reduce a loop for any dev using jquery ui. Just my two cents.

Note: See TracTickets for help on using tickets.