html - jqgrid内联编辑显示html标签

标签 html jqgrid tags inline

我正在尝试使用jqgrid内联编辑功能。但是当触发内联编辑器时我得到了整个 html 标签。 enter image description here

可能是什么原因?谢谢。

这是 jqgrid 代码:

$(document).ready(function () {

'use strict';
var grid;

grid = jQuery("#list2");
grid.jqGrid({

    editurl: "clientArray",
    datastr: topicjson,
    datatype: "jsonstring",
    height: "auto",
    loadui: "disable",
    colNames: [/*"id",*/"Items","nick","url"],
    colModel: [
    //{name: "id",width:1, hidden:true, key:true},
    {name: "elementName", width:250, resizable: false, editable: true},
    {name: "nick", width:250, resizable: false, editable: true},
    {name: "url",width:1,hidden:true}
    ],
    treeGrid: true,
    treeGridModel: "adjacency",
    caption: "jqGrid Demos",
    ExpandColumn: "elementName",
    //autowidth: true,
    rowNum: 100,
    //ExpandColClick: true,
    treeIcons: {leaf:'ui-icon-document-b'},
    jsonReader: {
    repeatitems: false,
    root: "response"
    },
    cellEdit: true,
    cellSubmit: "clientArray",
    onSelectRow: function(id){
    if(id && id!==lastSel){ 
    jQuery('#list2').restoreRow(lastSel); 
    lastSel=id; 
    }
    jQuery('#list2').editRow(id, true); 
    }   

});

});

最佳答案

事实证明,您可以在编辑之前使用 formatCell 事件更改单元格内容。返回值就是你想要的内容。对于这种特殊情况,treeGrid 具有小图像,单元格中包含所有 html 标签。当您编辑单元格时,默认情况下所有内容都显示为单元格内容。要修复它,您可以执行以下操作:

  formatCell: function(rowid,cellname,value,iRow,iCol) {
    return whatever_you_want_to_be;
  }

关于html - jqgrid内联编辑显示html标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11423872/

相关文章:

javascript - 使用什么框架/工具来构建基于网络的移动应用程序并支持向设备推送通知?

php - 免费的 jqGrid - 使用 PHP 的 JSON 编码示例

php - 如何显示 "most popular"标签

java - 了解 Java 内存模型和垃圾收集

mysql - 如何存储关键字/标签

jquery - CSS :after not working properly in FireFox

android - Webview 不支持 Android Jellybean 上的 flex box

html - 错误消息前后的 CSS

javascript - dataEvents 和 .change() 方法在 jqgrid/jquery 中不起作用

javascript - 如何修复无法读取 free-jqgrid 中未定义的属性 'rowIndexes'