Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ExtJS:HTMLEditor在Accordion重新扩展时丢失内容_Javascript_Extjs - Fatal编程技术网

Javascript ExtJS:HTMLEditor在Accordion重新扩展时丢失内容

Javascript ExtJS:HTMLEditor在Accordion重新扩展时丢失内容,javascript,extjs,Javascript,Extjs,我有一个典型设置的手风琴面板。在每个面板中都有一个textarea,一切正常 现在我将每个textarea替换为htmleditor。当我折叠面板并重新展开它时,htmleditor的内容将丢失。这在我使用textarea时没有发生。如何解决这个问题 编辑:另外,当重新展开时,htmleditor冻结,我无法输入任何内容。但是按钮可以工作(粗体、插入链接、切换到源代码编辑等)。更奇怪的是,当我两次切换“切换到源代码”按钮时,内容会以不同的字体重新出现 使用手风琴: myDataStore.loa

我有一个典型设置的手风琴面板。在每个面板中都有一个
textarea
,一切正常

现在我将每个
textarea
替换为
htmleditor
。当我折叠面板并重新展开它时,
htmleditor
的内容将丢失。这在我使用
textarea
时没有发生。如何解决这个问题

编辑:另外,当重新展开时,
htmleditor
冻结,我无法输入任何内容。但是按钮可以工作(粗体、插入链接、切换到源代码编辑等)。更奇怪的是,当我两次切换“切换到源代码”按钮时,内容会以不同的字体重新出现

使用手风琴:

myDataStore.load({params: ...}, callback: onLoadSuccess);
......

onLoadSuccess: function() {
    // for each data item, create a new panel and add it to myListPanel
    for (var i = 0; i < myDataStore.getTotalCount(); i++) {
        var dataItem = myDataStore.getAt(i);
        var newFormPanel = new Ext.FormPanel({
            labelAlign: 'top',
            items : [{
                xtype: 'htmleditor',
                fieldLabel: 'Content',
                autoScroll: true,
                enableFont: false,
                enableLists: false,
                value: dataItem.get('content');
            }],
            buttons: [{...}]
        });
        // add this panel to the accordion
        myListPanel.add({
            title: 'Another panel',
            items: [newFormPanel]
        });
    }
    myListPanel.doLayout();
}

对我来说,
htmleditor
在折叠和扩展时不会丢失内容

但是,一种解决方案是侦听
折叠
事件并将当前编辑器内容存储到属性中。
展开
事件中,再次将其放置在编辑器中。

能否发布完整的工作代码?完整代码太长。。。我更新了
Accordion
的用法:新面板从数据存储添加到Accordion面板。更新:我将
animate
设置为
false
,问题解决了@_@
var myListPanel = new Ext.Panel({
    autoHeight : true,
    autoWidth: true,
    autoScroll : true,
    layout : 'accordion',
    layoutConfig : {
        titleCollapse: true,
        animate: true,
        fill : false,
        autoWidth: true,
        hideCollapseTool: true,
    },
});