KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I dynamically update the items in a drop down? I have a custom plugin for CKEditor that populates a drop down menu with a list of items which I can inject into my textarea . This list of items comes from a Javascript array called maptags , which is updated dynamically for each page. var maptags = [] This list of tags gets added to the drop down when you first click on it by the init: function. My problem is what if the items in that array change as the client changes things on the page, how can I reload that list to the updated array? Here is my CKEditor Plugin code: CKEDITOR.plugins.add('mapitems', { requires: ['richcombo'], //, 'styles' ], init: function (editor) { var config = editor.config, lang = editor.lang.format; editor.ui.addRichCombo('mapitems', { label: "Map Items", title: "Map Items", voiceLabel: "Map Items", className: 'cke_format', multiSelect: false, panel: { css: [config.contentsCss, CKEDITOR.getUrl(editor.skinPath + 'editor.css')], voiceLabel: lang.panelVoiceLabel }, init: function () { this.startGroup("Map Items"); //this.add('value', 'drop_text', 'drop_label'); for (var this_tag in maptags) { this.add(maptags[this_tag][0], maptags[this_tag][1], maptags[this_tag][2]); } }, onClick: function (value) { editor.focus(); editor.fire('saveSnapshot'); editor.insertHtml(value); editor.fire('saveSnapshot'); } }); } });
Tags (comma-separated)
Save Edits
Cancel