I need to set the JQgrid cell value based on the condition, suppose the variable value is one then i need to set a bike, if it is 2 then i need to set as car, and so on.
Can anyone please explain how to achieve this?
You can achieve this using the formatter
<script>
jQuery("#grid_id").jqGrid({
...
colModel: [
...
{name:'price', index:'price', width:60, align:"center", editable: true, formatter:vehicalFmatter},
...
]
...
});
function vehicalFmatter (cellvalue, options, rowObject)
{
if (cellvalue == 1)
return "Bike";
else if (cellvalue == 2)
return "Car";
}
</script>
Reference: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter