I would like to define defaults for nested options like this:
$("div").filters({
url : 'url.example.com'
filters : {
'projects' : {
'type' : 'dropdown',
'min' : 1,
'max' : 10,
'htmlOptions': {
'name' : 'projects',
'class': 'filters',
'id' : 'project-filter',
}
},
'another' : {
'type' : 'dropdown'
}
...
}
});
I use jQuery $.extend()
to merge these with the defaults in my plugin code like this:
settings = $.extend(defaults,options);
My code is too big so I cannot put all of it here.
The problem I am having is that settings.url
works, but I don't know how to do the same with settings.filters
because I don't know how many filters the developer is going to want to put here.
Can anyone suggest a better method of dealing with this maybe?