いくつかの投稿を読みましたが、jqgridを初めて使用するため、まだフォローできません。5列のjqgridがありますが、最初は1列が空です。いくつかの更新を行った後、それは満たされます。
JQgridでこの行のフォントの色を変更したいので、この行が塗りつぶされている場合は、この行のフォントの色が青に変更されます。
jQuery("#list").jqGrid({
....
colModel :[
{name:'prob_id', index:'prob_id', hidden:true, width:10},
{name:'Model',index:'Model',width:100,editable:true,search:true,stype:'text',searchoption:{sopt:['cn']}},
{name:'Serial', index:'Serial',width:80,editable:true,search:true,stype:'text',searchoptions:{sopt:['cn']}},
{name:'Lotno', index:'Lotno', width:50, editable:true,
search:true,
stype:'text',
searchoption:{sopt:['cn']}},
{name:'Detail', index:'Detail', hidden:true,width:70,formatter:myformat}
],
....
function myformat ( cellvalue, options, rowObject )
{
if (!empty(cellvalue)){
return '<font color="blue">' + cellvalue + '</font>';//or use classes
} else{
return '<font color="black">' + cellvalue + '</font>';//or use classes
}
}
詳細フィールドの値を持つすべての行のフォントの色を変更したい
しかし、エラーが発生します:
empty is not defined
アップデート
この方法を試してください:条件を次の場所に移動することにしました:
function myformat ( cellvalue, options, rowObject )
{
if (cellvalue == "closed"){
return '<font color="blue">' + cellvalue + '</font>';//or use classes
} else{
return '<font color="black">' + cellvalue + '</font>';//or use classes
}
}
動作しますが、1列だけが青に変わるようです。条件のある行全体が必要ですCLOSED
。