View Full Version : [CLOSED] HtmlEditor as a editor issue

Jun 06, 2014, 8:30 AM
hi,i am in trouble with the htmlediot in edtor
1,when pop up the htmleditor, i edit it . the editor can not auto disappear after editing.
2,the htmleditor is out of page.

sample code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm54.aspx.cs" Inherits="web.qizweb.com.test.WebForm54" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script runat="server">
protected void LoadAnnounce(object sender, StoreReadDataEventArgs e)
var ll = new object[]
new {id=1,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"},
new {id=2,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"},
new {id=3,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"},
new {id=4,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"},
new {id=5,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"},
new {id=6,title="aaa",info="bbb",addtime="1992-11-28 12:23:33"}
e.Total = 6;
s_announce.DataSource = ll;
<form id="form1" runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>
<ext:GridPanel runat="server" Title="公告管理">
<ext:Store runat="server" ID="s_announce" OnReadData="LoadAnnounce">
<ext:Model runat="server">
<ext:ModelField Name="id"></ext:ModelField>
<ext:ModelField Name="title"></ext:ModelField>
<ext:ModelField Name="info"></ext:ModelField>
<ext:ModelField Name="addtime"></ext:ModelField>
<ext:Column runat="server" DataIndex="id" Text="编号"></ext:Column>
<ext:Column runat="server" DataIndex="title" Text="标题">
<ext:TextField runat="server"></ext:TextField>

<ext:Column runat="server" DataIndex="info" Text="内容" Flex="1">
<ext:HtmlEditor runat="server"></ext:HtmlEditor>
<ext:DateColumn runat="server" DataIndex="addtime" Text="入库时间" Format="yyyy-MM-dd HH:mm:ss" Width="140"></ext:DateColumn>

<ext:CellEditing runat="server"></ext:CellEditing>
<ext:RowSelectionModel runat="server" Mode="Multi"></ext:RowSelectionModel>

Jun 06, 2014, 12:33 PM
Hi @hdsoso,

Yes, it might be too problematic or just impossible to use an HtmlEditor as a Column's Editor. Mostly, because of the fact that an HtmlEditor uses an iframe.

As a possible solution I can suggest to use a TriggerField in a similar way as it is done in this example.

Jun 06, 2014, 2:41 PM
can place a htmleditor into the window in above example?
could you please provide an example of poping up a window which in it there is a htmleditor when click a cell ,after editing , the htmledtor's text will place into the cell?

Jun 06, 2014, 3:11 PM
can place a htmleditor into the window in above example?

Please just put an HtmlEditor into a Window's Items.

Jun 07, 2014, 1:00 AM
Cannot call method 'saveValue' of undefined
setCompany not execute ?
the text of cell can not load to htmleditor's text?

var triggerClick = function (el, trigger, tag, auto, index) {
switch (tag) {
case "pick":
var w = App.PickWindow;
w.editor = el;
w.autoComplete = auto;

w.show(trigger, function () {
case "complete":
var setCompany = function (w) {
var record = App.CellEditing1.getActiveRecord(),
company = w.editor.getValue();
// rating = record.get("rating");


var saveCompany = function (w) {
// App.CellEditing1.getActiveRecord().set("rating", App.CompanyRating.getChecked()[0].tag);

<ext:ResourceManager runat="server" SourceFormatting="True"></ext:ResourceManager>
<ext:Window runat="server" ID="PickWindow" Title="内容" Hidden="true" Width="300" Height="250">
<ext:Panel runat="server">
<ext:HtmlEditor runat="server" ID="HtmlEditor1"></ext:HtmlEditor>
<ext:ConfigItem Name="initValue" Value="setCompany" Mode="Raw" />
<ext:ConfigItem Name="saveValue" Value="saveCompany" Mode="Raw" />
<ext:Button runat="server" Text="OK">
<Click Handler="#{PickWindow}.hide(); #{PickWindow}.layout.activeItem.saveValue(#{PickWi ndow}); if (#{PickWindow}.autoComplete) {#{CellEditing1}.completeEdit();}" />
<ext:Button runat="server" Text="Cancel">
<Click Handler="#{PickWindow}.hide(); if (#{PickWindow}.autoComplete) {#{CellEditing1}.cancelEdit();}" />

<ext:Column runat="server" DataIndex="info" Text="内容" Flex="1">
<ext:TriggerField runat="server">
<ext:FieldTrigger Icon="SimpleEllipsis" Tag="pick" />
<ext:FieldTrigger Icon="SimpleTick" Tag="complete" />
<TriggerClick Handler="triggerClick(this, trigger, tag, true, 0);" />
<EditorOptions AllowBlur="false" />

<ext:CellEditing runat="server" ID="CellEditing1">
<Edit OnEvent="EditAnn">
<ext:Parameter Name="title" Value="e.record.data.title" Mode="Raw" />
<ext:Parameter Name="info" Value="e.record.data.info" Mode="Raw" />
<ext:Parameter Name="id" Value="e.record.data.id" Mode="Raw" />

Jun 09, 2014, 10:17 AM
Please provide a full test case.