将RTE与JQGrid集成

时间:2013-04-25 10:51:28

标签: jqgrid inline-editing rte

我正在使用事件进行内联编辑。点击一个不可编辑的单元格,我想打开Rich Text Box。我尝试使用edittype:custom并返回rte但没有显示。还有其他办法吗?

请建议!

谢谢, Arshya

2 个答案:

答案 0 :(得分:1)

使用edittype: custom对于不可编辑的列没有意义。使用editable: true

使列可编辑

答案 1 :(得分:0)

我能够使用以下解决方案实现这一目标

在加载完成后,我添加了代码以在单击单击

上打开div
loadComplete: function() {
        var iColNotesPresent = getColumnIndexByName($(this), 'NotesPresent'), rows = this.rows, i, c = rows.length;
        var iColNotes = getColumnIndexByName($(this), 'Notes');

        for (i = 1; i < c; i += 1) {
            $(rows[i].cells[iColNotesPresent]).click(function(e) {
                var offset = jQuery(e.target).offset();
                var rteText = $(jQuery(e.target).parent()[0].cells[iColNotes])[0].outerText;
                var rowId = jQuery(e.target).parent()[0].id;
                OpenRTEBox(offset, rteText, rowId);
            });
        }
    },

//Open the div containing RTE 
function OpenRTEBox(offset, rteText, rowId) {

isColNotes = true;
currsel = rowId;  

$('#rteDiv').css({ position: "absolute", top: offset.top, left: offset.left, "z-index": 20 });
$('#rteDiv').show();

frames['rte0'].document.body.innerHTML = rteText;    

}

这是RTE的html代码                                            

                <script language="javascript" type="text/javascript">
                    writeRichText("rte0", "rte0", 575, 200, true, false, "Notes");
                </script>

            </td>
        </tr>
        <tr>
            <td align="right">
                <input type="button" id="btnOK" onclick="addNotes();" value="OK"/>
            </td>
            <td align="left">
                <input type="button" id="btnCancel" onclick="closeDiv();" value="Cancel"/>
            </td>
        </tr>
    </table>
</div>