修改没有cellattr的jqgrid cell
Modify jqgrid cell without cellattr
我需要更改我的 jqgrid 中其中一列的一些单元格。
我需要放置一个条件语句来区分每个单元格,但我有 4.0.0 jqGrid 版本并且 colModel 没有属性 cellattr
现在,这就是我所拥有的:
colModel:[
{
name : 'compras',
index : 'num_compras',
jsonmap : 'num_veces',
width : 50,
edittype :'select',
formatter:'showlink',
formatoptions:
{
baseLinkUrl:'/myURL'
}
}
]
我需要使某些单元格不可点击,因为它们就像锚标记。
提前致谢!!
您可以尝试使用 formatter: "dynamicLink"
而不是 formatter:'showlink'
。我建议如果在 the old answer. It should work with retro version 4.0.0. You can download it here. It is very flexible and I think you would be able implement all your requirement. Nevertheless I'd recommend you to upgrade to the current version of free jqGrid (version 4.13.0) because the version 4.0.0 is dead since a long time. You can try free jqGrid just by replacing the URLs to jqGrid files to the URLs described in the wiki.
最后在gridComplete
函数中找到了最简单的解决方案,如下:
gridComplete: function(){
var grid = jQuery(this);
var ids = grid.jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
if(grid.getCell(ids[i], 'my_column_identification') == 0){ //or other condition
grid.setCell(ids[i], 'my_column_identification', "", {'pointer-events': 'none', 'cursor': 'default'})
}
}
}
我需要更改我的 jqgrid 中其中一列的一些单元格。
我需要放置一个条件语句来区分每个单元格,但我有 4.0.0 jqGrid 版本并且 colModel 没有属性 cellattr
现在,这就是我所拥有的:
colModel:[
{
name : 'compras',
index : 'num_compras',
jsonmap : 'num_veces',
width : 50,
edittype :'select',
formatter:'showlink',
formatoptions:
{
baseLinkUrl:'/myURL'
}
}
]
我需要使某些单元格不可点击,因为它们就像锚标记。
提前致谢!!
您可以尝试使用 formatter: "dynamicLink"
而不是 formatter:'showlink'
。我建议如果在 the old answer. It should work with retro version 4.0.0. You can download it here. It is very flexible and I think you would be able implement all your requirement. Nevertheless I'd recommend you to upgrade to the current version of free jqGrid (version 4.13.0) because the version 4.0.0 is dead since a long time. You can try free jqGrid just by replacing the URLs to jqGrid files to the URLs described in the wiki.
最后在gridComplete
函数中找到了最简单的解决方案,如下:
gridComplete: function(){
var grid = jQuery(this);
var ids = grid.jqGrid('getDataIDs');
for(var i=0;i < ids.length;i++){
if(grid.getCell(ids[i], 'my_column_identification') == 0){ //or other condition
grid.setCell(ids[i], 'my_column_identification', "", {'pointer-events': 'none', 'cursor': 'default'})
}
}
}