首页 \ 问答 \ 在Extjs中加载HtmlEditor内的内容(Load content inside HtmlEditor in Extjs)

在Extjs中加载HtmlEditor内的内容(Load content inside HtmlEditor in Extjs)

我是Extjs的学习者,如何在Extjs html编辑器中加载内容

这是空白的编辑器代码

<!DOCTYPE html>
<html>
<head>
   <link href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
   <script type="text/javascript">
      Ext.onReady(function() {
         Ext.create('Ext.form.HtmlEditor', {
            width: 580,
            height: 250,
            renderTo: document.getElementById('editorId')
         });
      });
   </script>
</head>
<body>
   <div id = "editorId"></div>
</body>
</html>

我试过这个但是不行

document.getElementById("content").innerHTML ="this is the content inside";

I am a learner of Extjs , How to load content inside Extjs html editor

This is the blank editor code

<!DOCTYPE html>
<html>
<head>
   <link href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" rel="stylesheet" />
   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
   <script type="text/javascript">
      Ext.onReady(function() {
         Ext.create('Ext.form.HtmlEditor', {
            width: 580,
            height: 250,
            renderTo: document.getElementById('editorId')
         });
      });
   </script>
</head>
<body>
   <div id = "editorId"></div>
</body>
</html>

I tried this but don't work

document.getElementById("content").innerHTML ="this is the content inside";

原文:https://stackoverflow.com/questions/42344908
更新时间:2022-03-28 20:03

最满意答案

这是我测试过的正确代码。

我会告诉你删除return false并使下面的ajax调用显式附加成功和失败回调。

$(document).on("click", ".alert", function (e) {
            bootbox.confirm("Delete payment ???", function (result) {
                    if (result) {
                        alert('delete fired');
                        $.ajax({
                            type: "GET",
                            url: "Jquery-datatable.aspx/GetJsonEmps",
                            data: "{}",
                            dataType: "json",
                            contentType: "application/json; charset=utf-8",
                            success: function (response) {
                                alert('ok');
                                location.reload();
                            },
                            error: function (xhr, ajaxOptions, thrownError)
                            { 
                            alert(xhr.responseText);
                            location.reload(); 
                            }    
                        });
                    }
                });
            });

注意:为了测试,我已经快速检查了上面的示例。您必须将rquest类型替换为POST并请求url并添加data参数。


Here is the correct code I have tested.

I would tell you to remove return false and make the ajax call like below having explicitly attaching success and failure callback.

$(document).on("click", ".alert", function (e) {
            bootbox.confirm("Delete payment ???", function (result) {
                    if (result) {
                        alert('delete fired');
                        $.ajax({
                            type: "GET",
                            url: "Jquery-datatable.aspx/GetJsonEmps",
                            data: "{}",
                            dataType: "json",
                            contentType: "application/json; charset=utf-8",
                            success: function (response) {
                                alert('ok');
                                location.reload();
                            },
                            error: function (xhr, ajaxOptions, thrownError)
                            { 
                            alert(xhr.responseText);
                            location.reload(); 
                            }    
                        });
                    }
                });
            });

Note: I have quickly checked above example for the sake of testing.You have to replace the rquest type to POST and request url and add data parameter.

相关问答

更多
  • 我会考虑改变你的设计。 要么摆脱自动刷新,而是使用AJAX调用来更新您的页面。 以下是显示AJAX基础的页面: https : //www.w3schools.com/xml/ajax_intro.asp 您可以将页面设置为在刷新时自动加载模式。 但是我有一种感觉,你可能会让人们进入那个盒子,所以内容将会丢失。 这不是一个好的用户体验。 对于低科技解决方案,您可以弹出一个小窗口,以便使用Javascript提交文章。 这会使你的阅读脱离文章,并且你可以刷新其他页面。 简单的代码弹出一个新窗口是:
  • 尝试向CSS文件网址添加参数: mystyles.css?12345 大多数浏览器使用参数完成URL的重新加载。 但请确保,当您的网站进入生产模式时,请将其删除! Try adding a parameter to the CSS file URL: mystyles.css?12345 Most browsers do a complete reload of URLs with parameters. But make sure, you remove that, when your site go ...
  • 您忘记将事件变量e作为参数传递给提交回调: $("#email-form").submit(function(e){ //Here requestTruckWarning(); // creates a colorbox e.preventDefault(); // trying to prevent page from refreshing but never hits this breakpoint? }); You forge ...
  • AJAX的重点不是做数据库操作,而是与服务器通信而无需重新加载页面。 我认为您的描述符合使用AJAX的要求,因为您确实希望从服务器获得答案,并且您不想重新加载页面。 你也可以打开一个iframe或一个新窗口,但是ajax可能就是这里的解决方案。 请记住,单击锚点时需要取消该事件。 所以,使用ajax你可以这样: $('a').on('click', function(e) { e.preventDefault; var href = this.getAttribute('href'); $.aj ...
  • 我找到了自己的答案,希望能帮助其他人,我会在这里发布。 在更新面板中包装datadgrid帮助了我!
    事件处理程序仅绑定到当前选定的元素; 它们必须存在于您的代码进行事件绑定调用时页面上。 在您更新HTML时。 您需要使用.on()委托事件方法来使用事件委派 。 即 $(document).on('event','selector',callback_function) 代替document您应该使用最接近的静态容器以获得更好的性能。 委派事件的优点是,它们可以处理来自稍后添加到文档的后代元素的事件。 通过选择在附加委托事件处理程序时保证存在的元素,我们可以使用委托事件将click事件绑定到动态创建的元素 ...
  • $(".remove").click(function() { removeOption($(this)); return false; }); $(".remove").click(function() { removeOption($(this)); return false; });
  • 你可以尝试做这样的事情。 $( "body").fadeOut( function(){ location.reload(true); setTimeout( function(){ $(body).fadeIn(); }, 5000); }); 虽然写作找到了更好的方法: $( "body").fadeOut( function(){ location.reload(true); ...
  • 这是我测试过的正确代码。 我会告诉你删除return false并使下面的ajax调用显式附加成功和失败回调。 $(document).on("click", ".alert", function (e) { bootbox.confirm("Delete payment ???", function (result) { if (result) { alert('delete fired'); ...
  • 页面正在刷新,因为表单已提交。 如果你不想提交,请使用return false; 或event.preventDefault(); $(function () { $('#add').on('click', function(event) { $('#headline').text("Hurra!"); event.preventDefault(); }); }) the page is refreshing because the form is getting submitte ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)