【发布时间】:2014-08-26 09:25:50
【问题描述】:
我正在使用带有动态colmodel 的 jqgrid(表单编辑),如果需要,我必须根据某些值在单元格内显示图像,其中相同单元格的编辑类型为select。
因此,在视图和编辑过程中,图像应显示在网格中,单元格应设为select。不知道如何使用formatter。
//代码:
case 'dropdown':
colname.push({
name: this.Name, index: this.Name, width: 130, edittype: "select", formatter: 'select', editoptions: { value: ':Select;' + this.ValueList.slice(0, -1) }, stype: 'select', searchoptions: { value: ':All;' + this.ValueList.slice(0, -1) }, align: 'left', sortable: true });
break;
以上代码用于在编辑过程中将单元格创建为select 格式。现在我必须在同一个单元格内添加一个图像。
必须添加图像formatter 像这样吗?不知道在哪里。
//代码:
formatter: function () {
return "<img src='http://myserver/path/i.jpg' alt='my image' />";
}
我尝试像在上述代码中一样添加formatter,但它只显示图像而不是列的实际文本,并且在编辑中我无法加载所需的选定文本。
我怎样才能做到这一点?
【问题讨论】: