Skip to main content

Search and Top Navigation

#9943 closed feature (wontfix)

Opened March 30, 2014 08:40PM UTC

Closed March 30, 2014 11:58PM UTC

Last modified March 31, 2014 06:24AM UTC

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:
Description

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

Case in consideration - http://jsfiddle.net/aravindbaskaran/MJbr9/1/

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

Attachments (0)
Change History (5)

Changed March 30, 2014 08:55PM UTC by aravindbaskaran comment:1

Added to GitHub repos. Pull request submitted - https://github.com/jquery/jquery-ui/pull/1218

Please take a look.

Changed March 30, 2014 09:46PM UTC by scottgonzalez comment:2

owner: → aravindbaskaran
status: newpending

Why do you need this?

Changed March 30, 2014 11:00PM UTC by aravindbaskaran comment:3

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.

4. Add a beforeClose listener to check if the user has entered any value.

5. If user has not entered any value, continue to end. Else go to 5.

6. Open a modal confirm, informing the user about unsaved data that might be lost. Two actions -

A. Confirm close and lose data

B. Cancel and return to form

7. If A is chosen, close the modal confirm, and call modal form ("close") API

8. If B is chosen, close the modal confirm

Fiddle link - http://jsfiddle.net/aravindbaskaran/wwdar/

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.

Changed March 30, 2014 11:58PM UTC by scottgonzalez comment:4

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.

Changed March 31, 2014 06:24AM UTC by aravindbaskaran comment:5

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.