如何在 JQGrid 上添加多个格式化程序
How to add multiple formatter on JQGrid
ColModel的最后一个值,只显示最后一个NAME:,有没有办法显示所有的NAME:?感谢你的帮助。谢谢
colModel: [
{
name: 'PRIORITY_CD', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true,
},
{
name: 'CODE_COMBI', index: 'CODE_COMBI', width: 200, editable: true, sortable: true
},
{
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: detailsLink,
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: editLink,
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: deleteLink
},
]
function detailsLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Details</a>";
function editLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Edit</a>";
function deleteLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Delete</a>";
}
您定义 colModel 的方式不正确。为了做你想做的事,你可以在 colModel 中有一个字段和一个带有三个链接的格式化程序,如下所示:
colModel: [
{
name: 'PRIORITY_CD', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true,
},{
name: 'CODE_COMBI', index: 'CODE_COMBI', width: 200, editable: true, sortable: true
},{
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: vieweditdel
}
]
function vieweditdel(cellValue, options, rowdata, action) {
var detail = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Details</a>";
var edit = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Edit</a>";
var delete = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Delete</a>";
return detail+edit+delete;
}
ColModel的最后一个值,只显示最后一个NAME:,有没有办法显示所有的NAME:?感谢你的帮助。谢谢
colModel: [
{
name: 'PRIORITY_CD', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true,
},
{
name: 'CODE_COMBI', index: 'CODE_COMBI', width: 200, editable: true, sortable: true
},
{
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: detailsLink,
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: editLink,
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: deleteLink
},
]
function detailsLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Details</a>";
function editLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Edit</a>";
function deleteLink(cellValue, options, rowdata, action) {
return "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Delete</a>";
}
您定义 colModel 的方式不正确。为了做你想做的事,你可以在 colModel 中有一个字段和一个带有三个链接的格式化程序,如下所示:
colModel: [
{
name: 'PRIORITY_CD', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true,
},{
name: 'CODE_COMBI', index: 'CODE_COMBI', width: 200, editable: true, sortable: true
},{
name: 'ACTION', index: 'PRIORITY_CD', width: 200, editable: true, sortable: true, formatter: vieweditdel
}
]
function vieweditdel(cellValue, options, rowdata, action) {
var detail = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Details</a>";
var edit = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Edit</a>";
var delete = "<a href=''../../C3Web/CriteriaCombinationMapping/GetCritCombiMap'" + rowdata.PRIORITY_CD + " > Delete</a>";
return detail+edit+delete;
}