Tinymce未在部分视图MVC3中加载


$("#ddl").change(function () {
        var strSelected = "";
        $("#ddl option:selected").each(function () {
            strSelected += $(this)[0].value;
        });
        if (strSelected.length != 0) {
            var url = "/Reseller/MailPartial/?resellerId=" + strSelected;
            $("#mail").empty();
            $("#mail").load(url);
        }

这是我用来在视图中加载部分的代码(部分是1个标签和1个编辑器,应该加载Tinymce的代码)。我在模型中有[uihint(" tinymce_jquery_full"),lassehtml],而Tinymce编辑器在其他视图中完全正常。但是,当我使用部分视图时,它会恢复为纯文本区域。如何解决此问题?

谢谢

编辑:

我弄清楚了,ijaz几乎是正确的;)

我需要像ijaz所说的那样重新固定Tinymce,但是即使我像Ijaz一样打电话给Inittinymce时,这并不重要,因为该元素还没有加载到HTML上,我也不知道为什么。解决方案是在元素加载到页面后调用intitinymce。

我试图使用 $("#mail")。加载(url,inittinymce());但这无效。

有什么想法在加载元素后如何调用intitinymce()?它现在正在工作,但它依靠按下另一个按钮触发intitinymce()

再次编辑我将代码更改为纯Ajax,No More .load()

很抱歉如此混乱:)

在上述代码中,似乎[uihint]未正确应用。因此,让事情起作用,请初始化Tinymce Manualy,我的意思是将您的代码更改为

 $("#ddl").change(function () {
            var strSelected = "";
            $("#ddl option:selected").each(function () {
                strSelected += $(this)[0].value;
            });
            if (strSelected.length != 0) {
                var url = "/Reseller/MailPartial/?resellerId=" + strSelected;
                $("#mail").empty();
                $("#mail").load(url);
**Re-Init TinyMCE** 
InitTinyMCE();
                }
function InitTinyMCE()
{
  $('#@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)').tinymce({
            // Location of TinyMCE script
            script_url: '@Url.Content("~/Scripts/tinymce/tiny_mce.js")',
            theme: "advanced",
            height: "170",
            width: "240",
            verify_html : false,
            plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
            // Theme options
            theme_advanced_buttons1: "undo, redo,pasteword,|, bold, italic, underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,image, emotions" ,
            theme_advanced_buttons2: "charmap, bullist, numlist,|,formatselect,fontselect,fontsizeselectcode, |,tiny_mce_wiris_formulaEditor,  fullscreen",
            theme_advanced_buttons3: "",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true,
            // Example content CSS (should be your site CSS)
            content_css : "@Url.Content("~/Scripts/tinymce/css/content.css")",
            convert_urls : false,
            // Drop lists for link/image/media/template dialogs
            template_external_list_url : "lists/template_list.js",
            external_link_list_url : "lists/link_list.js",
            external_image_list_url : "lists/image_list.js",
            media_external_list_url : "lists/media_list.js"
        });
}

最新更新