1

I'm writing a plugin for TinyMCE, and I want to have ListBox B dependent on what's selected in Listbox A. I can make it so the initial selection in ListBox A fills ListBox B, but I cannot make a second selection, wipe ListBox B clean, and fill ListBox B with the new items.

I've tried using just Native ListBoxes and JQuery functions but JQuery can't find them on the page.

Thanks!

4

2 回答 2

0

这是一个对我有用的解决方法。我的 ListBox 包含类名(cssclass 是一个包含简单字符串的变量):

listbox = ed.controlManager.get('p_style'); // listboxname
if (typeof listbox == "undefined") return;

// after rendering, no new listbox elements can be entered -> workaround
if (listbox && listbox.isMenuRendered) {
    listbox.menu.destroy();
    listbox.isMenuRendered = false;
    listbox.oldID = 0;
}

// class zu Listboxen hinzufügen
if (listbox)
    listbox.add(cssclass, cssclass);
于 2010-12-01T13:41:34.127 回答
0

TinyMCE 创建一个 iframe 来保存它正在编辑的内容,因此您要搜索的列表框在那里而不是主文档中。您可以使用 tinymce.get('editor_id').getDoc() 函数从 iframe 中检索文档(请参阅http://tinymce.ephox.com/documentation/api/index.html#class_tinymce.Editor.html-获取文档)。如果您在该文档上定位标准 JQuery 函数,它应该可以工作。

问候,

阿德里安·萨顿。
http://tinymce.ephox.com

于 2010-06-11T09:03:35.773 回答