#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: |
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.
Change History (5)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Owner: | set to aravindbaskaran |
---|---|
Status: | new → pending |
Why do you need this?
comment:3 Changed 9 years ago by
Status: | pending → new |
---|
Consider the below case,
- There is a modal form to collect input from user.
- User can close the dialog by clicking on - "Cancel" or close ui button.
- Add a beforeClose listener to check if the user has entered any value.
- If user has not entered any value, continue to end. Else go to 5.
- Open a modal confirm, informing the user about unsaved data that might be lost. Two actions -
- Confirm close and lose data
- Cancel and return to form
- If A is chosen, close the modal confirm, and call modal form ("close") API
- 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.
comment:4 Changed 9 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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
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.
Added to GitHub repos. Pull request submitted - https://github.com/jquery/jquery-ui/pull/1218
Please take a look.