Just call .dynamicSelect() on the select, optionally passing an options object as described under “Options.”
$("#MySelect").dynamicSelect();
Updating
To update the select, use the dynamicSelect() method, and pass "update" as the first argument and an array of menu items as the second. Here is an example demonstrating the required schema for the menu items array.
Great, but what if my data isn’t in this format? When you setup the dynamicSelect, you can set a filter option to specify a function used to process the data. Any time you call .dynamicSelect("update", data), the data argument is passed to the filter function, and the result it passed to the updatemethod.
Options
The dynamicSelect() method accepts an optional argument for overriding options.
Property
Type
Description
filter
function
Function for processing the data when calling "update". Function must take one object as an argument and return an array appropriate for processing.
I’d like to have more control about whether an update fires an change event. I had some problems when I tried to create forms with dependencies (when x changes show and update y).
I got problems using the plugin with jquery 1.4.2. Firebug says “opts is not a function”. 1.4.1 works fine.
I’d like to have more control about whether an update fires an change event. I had some problems when I tried to create forms with dependencies (when x changes show and update y).