jqGrid pass value to form editing
作为对此的后续问题...我有一个网格,其中一个单元格作为复选框和表单编辑。我能够使用此解决方案加载单元格的值,但是在提交时它会传回格式化程序引号内的所有内容并引发服务器错误。我怎样才能传回1:0的值?
来自网格的线......
{ name: 'NS', index: 'NS', width: 20, editable: true, hidden: false, edittype: 'checkbox', editrules: { edithidden: true, required: true }, formoptions: { rowpos: 11}, formatter: checkTrue }
使用的格式化程序......
formatter: function (cellvalue, options, rowdata) {
if (cellvalue == 0) {
return "<span class=\"ui-icon ui-icon-close\">0</span>";
} else {
return "<span class=\"ui-icon ui-icon-check\">1</span>";
}
}
答案 0 :(得分:0)
您可以使用unformatter
{ name: 'NS', index: 'NS', width: 20, editable: true, hidden: false, edittype: 'checkbox', editrules: { edithidden: true, required: true }, formoptions: { rowpos: 11}, formatter: checkTrue, unformat: unFormat }
function unFormat( cellvalue, options, cell){
return $('span', cell).text();
}
unformatter采用以下参数:
cellvalue - the value to be unformatted.
options - An object that contains the row id and column model
cellobject - A JQuery cell object.