jqgrid在弹出框中显示图像

jqgrid在弹出框中显示图像,jqgrid,prettyphoto,Jqgrid,Prettyphoto,我在应用程序中使用jqgrid和Pretto。 我有一列显示图像预览。单击该图像后,图像将显示在弹出框中。 网格代码是 ..... {name: 'imagePath', index: 'imagePath', width: 80, align: 'center', formatter :anchorFmatter, edittype: 'text', hidden: false, editable: true, editrules: {required: false}, e

我在应用程序中使用jqgrid和Pretto。
我有一列显示图像预览。单击该图像后,图像将显示在弹出框中。
网格代码是

.....  
{name: 'imagePath', index: 'imagePath', width: 80, align: 'center',
    formatter :anchorFmatter, edittype: 'text', hidden: false, editable: true,
    editrules: {required: false}, editoptions: {size: 30}}
....
function anchorFmatter(cellValue, options, rowObject)
{
    if(cellValue === null ){
        return "<a></a>";
    }else {
        jQuery("a[rel='image']").prettyPhoto({
            animation_speed:'normal',
            show_title:false,
            allow_resize:true,
            default_width:640,
            default_height:385,
            theme:'light_rounded',
            autoplay:false
        });

        return "<a href='" + cellValue + "' rel='image'><img src='" + cellValue +
               "' width='100' height='35'></a>";
    }
}   
。。。。。
{名称:'imagePath',索引:'imagePath',宽度:80,对齐:'center',
格式化程序:anchorFmatter,edittype:“文本”,隐藏:false,可编辑:true,
editrules:{required:false},editoptions:{size:30}
....
函数主播格式(单元格值、选项、行对象)
{
如果(cellValue==null){
返回“”;
}
}   
网格中的所有图像都将显示在弹出窗口中,但最后一个图像将显示在新的浏览器页面中。
可能会得到任何帮助。

提前感谢

在网格中,contain仍然以字符串形式存在,并且尚未放置在页面上。因此,您应该从formutter函数中删除调用
jQuery(“a[rel='image'])。相反,您可以在事件处理程序内部调用
jQuery(“a[rel='image'])。此外,如果尚未使用,则应使用
gridview:true
选项。这将提高网格性能。

非常感谢Oleg。它为我工作。非常感谢。Hai@Oleg,我面临着新的问题。当我在IE6中测试应用程序时,图像会出现在新窗口中(不会出现在弹出框中)。你能帮我找到解决这个问题的方法吗?@vissu pepala:看起来像是
prettypto
插件的IE6兼容性问题。如果不在jqGrid内部使用
prettypto
,是否也会出现同样的问题?很抱歉,响应太晚,这只是Prettypto插件的IE6兼容性问题。在IE8中工作良好。谢谢你的回答。@vissu pepala:对不起,我自己不使用
pretto
,所以在这方面我帮不了你。此外,我认为IE6太旧了,很少被使用,所以你不应该支持它。