colModel中可以设置Formatter
jqGrid预定义了很多格式,每个不同的格式有不同的参数设置,可以在formatoptions中设置。
例如
<script> jQuery("#grid_id").jqGrid({ ... colModel: [ {name:'myname', formatter:'showlink', formatoptions:{baseLinkUrl:'someurl.php', addParam: '&action=edit'}, ...} ... ] ... }); </script>
Type |
Options |
Description |
integer |
thousandsSeparator, |
thousandsSeparator determines the separator for the thousands, defaultValue set the default value if nothing in the data |
number |
decimalSeparator, |
thousandsSeparator determines the separator for the thousands, decimalSeparator determines the separator for the decimals, decimalPlaces determine how many decimal places we should have for the number, defaultValue set the default value if nothing in the data |
currency |
decimalSeparator, |
The same as number, but we add aditional two options - prefix: text that is inserted before the number and suffix: text that is added after the number |
date |
srcformat, |
srcformat is the source format - i.e. the format of the date that should be converted, newformat is the new output format. The definition of the date format uses the PHPconversions. Also you can use a set of predefined date format - see the mask options in the default date formatting set |
|
none |
When a mail type is used we directly add a href with mailto: before the e-mail |
link |
target |
The default value of the target options is null. When this options is set, we construct a link with the target property set and the cell value put in the href tag. |
showlink |
baseLinkUrl, |
baseLinkUrl is the link. |
checkbox |
disabled |
The default value for the disabled is true. This option determines if the checkbox can be changed. If set to false, the values in checkbox can be changed |
select |
none |
this is not a real select but a special case. See note below |
actions |
{ |
This type of formatter is a easy way to add a buttons at certain column for inline editing. We add a two types of actions edit and delete. When the editformbutton parameter is set to true the form editing dialogue appear instead of in-line edit. |
##########################################################################################
本文转自cnn23711151CTO博客,原文链接: http://blog.51cto.com/cnn237111/782123,如需转载请自行联系原作者