gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 00:17:23 25 4
gpt4 key购买 nike

我正在尝试使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com