主题: 【求救】Kindeditor第二次点击列表时无法将获取到的信息显示在编辑器上?
作者: jacksun, 发布日期: 2013-05-25 01:36:10, 浏览数: 3402

操作系统:
win7
浏览器版本: Firefox
KindEditor版本:
最新版
BUG再现步骤:
1.有一个列表页,双击后进入编辑页面;
2.第一次打开时,能获取到信息并且显示在kindeditor上;
3.第二次打开新记录时,能获取到信息,但是显示在kindeditor上的内容还是以前的内容,没更新。但是我弹出kindeditor里面的信息发现是正确的,就是界面的值没更新掉。
 
期望结果:

每次打开新的记录,能将内容信息及时的显示在kindeditor上。

 

部分代码如下,求高手指点:

 

弹出dialog:

 

//编辑信息
function EditBuildingsRentWindow(key) {
    var selectedRow = $('#grid_list').datagrid('getSelections');
    if (key == null || key == '' || key == 0) {
        if (selectedRow == null || selectedRow.length == 0) {
            $.messager.alert('提示', '请选择要修改的记录!', 'info');
            return;
        }
        if (selectedRow.length > 1) {
            $.messager.alert('提示', '每次只能修改一条记录!', 'info');
            return;
        }
        key = selectedRow[0].BuildingRentID;
    }

    Common.setDivDisplay('divSave', false, '');
    operateType = "update";

    var win;
    win = $("#divSave").window({
        title: "编辑信息",
        width: 800,
        height: '100%',
        shadow: true,
        modal: true,
        iconCls: 'icon-modify',
        closed: true,
        minimizable: false,
        maximizable: true,
        collapsible: false
    });

    win.window("open");

    //文本编辑器(正文)
    editorRemark=   KindEditor.create('#txtRemark', {
        resizeType: 1,
        autoHeightMode: true,
        afterCreate: function () {

                // 函数就是同步KindEditor的值到textarea文本框
                this.sync();
            //this.loadPlugin('autoheight');
        },
        afterBlur: function () {
            this.sync();
        }
    });

    getBuildingsRentInfo(key);
}

 

 

 

//获取详情
function getBuildingsRentInfo(key) {
    var type = operateType;
    var buildingsrentID = key;
    $("#txtBuildingRentID").text(buildingsrentID);
    if (type == "update") {
        var params = { type: 'detail', BuildingRentID: buildingsrentID };
        var param = jQuery.param(params);
        $.ajax({
            url: '/Ajax/buildingsrentHandle.ashx',
            type: 'post',
            data: param,
            dataType: 'json',
            success: function (result) {
                if (result != null) {
                    var data = result[0];
                    alert(editorRemark.html());//此时获取弹出空值
                    editorRemark.html(data.Remark);
                    alert( editorRemark.html());//此时弹出的值是正常的;但是界面的值没更新掉
                }
                else {
                    $.messager.alert("提示", '信息加载失败', 'info');
                }
            },
            error: function (data) {
                $.messager.alert("提示", '信息加载失败出错', 'error');
            }
        });
    }
}



//编辑信息
function EditBuildingsRentWindow(key) {
    var selectedRow = $('#grid_list').datagrid('getSelections');
    if (key == null || key == '' || key == 0) {
        if (selectedRow == null || selectedRow.length == 0) {
            $.messager.alert('提示', '请选择要修改的记录!', 'info');
            return;
        }
        if (selectedRow.length > 1) {
            $.messager.alert('提示', '每次只能修改一条记录!', 'info');
            return;
        }
        key = selectedRow[0].BuildingRentID;
    }

    Common.setDivDisplay('divSave', false, '');
    operateType = "update";

    var win;
    win = $("#divSave").window({
        title: "编辑信息",
        width: 800,
        height: '100%',
        shadow: true,
        modal: true,
        iconCls: 'icon-modify',
        closed: true,
        minimizable: false,
        maximizable: true,
        collapsible: false
    });

    win.window("open");

    //文本编辑器(正文)
    editorRemark=   KindEditor.create('#txtRemark', {
        resizeType: 1,
        autoHeightMode: true,
        afterCreate: function () {
                this.sync();
            //this.loadPlugin('autoheight');
        },
        afterBlur: function () {
            this.sync();
        }
    });

    getBuildingsRentInfo(key);
}

//编辑楼宇招租
function EditBuildingsRentWindow(key) {
    var selectedRow = $('#grid_list').datagrid('getSelections');
    if (key == null || key == '' || key == 0) {
        if (selectedRow == null || selectedRow.length == 0) {
            $.messager.alert('提示', '请选择要修改的记录!', 'info');
            return;
        }
        if (selectedRow.length > 1) {
            $.messager.alert('提示', '每次只能修改一条记录!', 'info');
            return;
        }
        key = selectedRow[0].BuildingRentID;
    }

    Common.setDivDisplay('divSave', false, '');
    operateType = "update";

    var win;
    win = $("#divSave").window({
        title: "编辑楼宇招租",
        width: 800,
        height: '100%',
        shadow: true,
        modal: true,
        iconCls: 'icon-modify',
        closed: true,
        minimizable: false,
        maximizable: true,
        collapsible: false,
        //href: "BuildingsRentInfo.aspx?type=update&BuildingsRent=" + selectedRow[0].BuildingsRent
    });

    win.window("open");

    //文本编辑器(正文)
    editorRemark=   KindEditor.create('#txtRemark', {
        resizeType: 1,
        autoHeightMode: true,
        afterCreate: function () {
                this.sync();
            //this.loadPlugin('autoheight');
        },
        afterBlur: function () {
            this.sync();
        }
    });

    //文本编辑器(在线地图)
    KindEditor.create('#txtOnlineMap', {
        resizeType: 1,
        width: '95%',
        height: '350px',
        //autoHeightMode: true,
        afterCreate: function () {
                this.sync();
            //this.loadPlugin('autoheight');
        },
        afterBlur: function () {
                this.sync();
        }
    });

    getBuildingsRentInfo(key);
}


 
发表新帖 发表回复