redking / chosen-dojo

Dojo Port of Chosen (https://github.com/harvesthq/chosen)
http://vafada.github.com/chosen-dojo/
Other
4 stars 5 forks source link

Updating Chosen Dynamically #4

Closed andimartin closed 9 years ago

andimartin commented 9 years ago

Thanks for your working in porting this to DOJO.

The original ChosenUI instructions state:

Updating Chosen Dynamically If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "liszt:updated" event on the field. Chosen will re-build itself based on the updated content.

MooTools Version: $("form_field").fireEvent("liszt:updated"); jQuery Version: $("#form_field").trigger("liszt:updated"); Prototype Version: Event.fire($("form_field"), "liszt:updated");

Looking through the code, it looks like this version uses topic.publish?

Is this correct, if so, how should it be formatted? I've tried topic.publish('liszt:updated'); and a number of variations around topic.publish('liszt:updated', mySelect); but am having no luck.

Thanks!

andimartin commented 9 years ago

Ah, just answered my own question. It takes an array - the following seems to work:

topic.publish('liszt:updated', [mySelect]);

redking commented 9 years ago

No problem!