Modify ↓
Ticket #2295 (closed enhancement: invalid)
UI plugins should expose defaults
| Reported by: | scott.gonzalez | Owned by: | paul |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.3 |
| Component: | ui | Version: | 1.2.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
UI plugins should expose their default settings so they can be changed by the user.
Change History
comment:2 follow-up: ↓ 5 Changed 5 years ago by scott.gonzal
In the resizable constructor, the following code is used to set the default settings:
//Prepare the passed options
this.options = $.extend({
preventDefault: true,
transparent: false,
minWidth: 10,
minHeight: 10,
aspectRatio: false,
disableSelection: true,
preserveCursor: true,
animate: false,
duration: 'fast',
easing: 'swing',
autohide: false
}, options);
If that was changed to:
//Prepare the passed options
this.options = $.extend($.ui.resizable.defaults, options);
And:
$.ui.resizable.defaults = {
preventDefault: true,
transparent: false,
minWidth: 10,
minHeight: 10,
aspectRatio: false,
disableSelection: true,
preserveCursor: true,
animate: false,
duration: 'fast',
easing: 'swing',
autohide: false
};
Then users could change the default behavior by changing the defaults. For instance, if I wanted all of my resizable elements to resize slowly, I could do:
$.ui.resizable.defaults.duration = 'slow';
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

What exactly do you mean by exposing the default settings?