Why aren't they meant to have complex options. I've created a custom
widget that uses another custom widget as well as a regular plugin in
it's prototype. It's very convenient to be able to pass the containing
widget the options for the member widget and plugin 'as is'. For
instance:

$.ui.mySuperWidget.defaults = {
    'myLittleWidgetOptions': {

    }
}

On Feb 19, 8:00 pm, Scott González <[email protected]> wrote:
> UI plugins aren't meant to have complex options.  Currently the only
> place where we have objects as options, it doesn't make sense to do a
> deep extend.  Also, doing a deep extend would be problematic if there
> were values that the user wanted to remove from the defaults.
>
> On Feb 18, 10:55 am, kazooka <[email protected]> wrote:
>
> > I'm creating custom widgets with 1.6rc6 and I noticed that when
> > creating a custom widget, the default options are NOT deep copied to
> > the options passed in during instantiation. For example:
>
> > // Create the widget
> > $.widget('myWidget', {
> >     init: function (){
> >             /*
> >               At this point, given the defaults and the instantiation
> > below,
> >               I would expect the this.options to contain...
> >                  {
> >                       title: 'My Widget',
> >                       classes: {
> >                             'header':  '.my-widget-header',
> >                             'content': '.my-widget-content',
> >                             'footer': '.custom-widget-footer'
> >                       }
> >                   }
>
> >                Instead, this.options contains (because of no 'deep
> > copy')...
> >                  {
> >                       title: 'My Widget',
> >                       classes: {
> >                             'footer': '.custom-widget-footer'
> >                       }
> >                   }
> >             */
> >         }
> >     }
> > );
>
> > // Set the widget defaults
> > $.ui.myWidget.defaults = {
> >     title: 'My Widget',
> >     classes: {
> >         'header':  '.my-widget-header',
> >         'content': '.my-widget-content',
> >         'footer': '.my-widget-footer'
> >     }
>
> > }
>
> > // Widgefy an element on the page with id='my-widget'
> > var testWidget = $('#my-widget').myWidget({
> >     classes: {
> >          'footer': '.custom-widget-footer'
> >     }
>
> > }
>
> > ---------
> > To me a deep copy makes more sense.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to