jqGrid custom formatter option "unformat" doesnt work when supplied with function.
I am supplying function to this option. custom formatter example suppose to work but its not working.
My main purpose of having unformat function is to give proper value to the sort function (when you sort by clicking on the sortable column header) which calls unformat and formatter supplied to the colModel.
Here is my code, (all the modules are included for jquery UI and jqgrid.)
<link href="../css/jquery-ui-1.8.11.custom.css" rel="stylesheet" type="text/css"/>
<link href="../css/ui.jqgrid.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../js/jquery-1.5.2.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript" src="../js/jquery.jqGrid.min.js"></script>
$("#GridTable").jqGrid({
datatype: "local",
colNames: ['id', 'col1', 'col2', 'col3', 'col4'],
colModel: [{name:'id',index:'id', align:'left', width:'260px'},
{name:'col1',index:'col1', width:'170px'},
{name:'col2',index:'col2', width:'160px'},
{name:'col3',index:'col3', sorttype:'float', width:'110px',unformat: unformatterFunction, formatter: formatterFunction },
{name:'col4',index:'col4', sorttype:'float', width:'110px'}
],
altRows: true,
caption: "Test Data",
height: '100%',
autowidth : true,
shrinkToFit: true,
});
function unformatterFunction(cellvalue, options, rowObject){
if(cellvalue=="-"){
return "0";
}
return cellvalue;
}
function formatterFunction(cellvalue, options, rowObject){
if(cellvalue > 15){
return "-";
}
return cellvalue;
}
I have spend lot of hours to trace the call into grid.base.js and found no way that goes to jquery.fmatter.js where the unformatFunction gets called for every row. My doubt is unformatFunction is not getting called while sorting.
I just confirmed by editing the example, that it is not working, something is horribly wrong. i can't think of any mistakes. its simply dont call the unformat function specified in colModel.