如何在编辑模式下在jqgrid中显示图像

时间:2011-09-30 15:44:59

标签: jqgrid

jqGrid包含使用下面的colmodel定义的image列。 image j在json中从服务器的单元格值传递。 如果不在编辑模式下,网格会正确显示图像。

内联和表单编辑模式显示错误的图像,因为editoptions src属性包含固定的id 1

如何在编辑模式下显示可编辑行ID的图像?如何将格式化函数传递给editoptions src属性?

name:"Image",
edittype:"image",
editoptions:{ src: "GetImage?id=1"},
formatter:function(cell,options,row) {
     return "<img src='GetImage?id=" +  cell + "'/>"
  }

1 个答案:

答案 0 :(得分:1)

我建议您在开始编辑之前立即更改src的{​​{1}}属性的值。有关详细信息,请查看the answer。如果是表单编辑,您可以使用beforeInitData修改editoptions

src

所以你会收到像

这样的编辑表格

enter image description here

表示网格

enter image description here

查看相应的演示here

相关问题