jqGrid细节备注—colModel中可以设置Formatter

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, 
defaulValue

thousandsSeparator determines the separator for the thousands, defaultValue set the default value if nothing in the data

number

decimalSeparator, 
thousandsSeparator, 
decimalPlaces, 
defaulValue

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, 
thousandsSeparator, 
decimalPlaces, 
defaulValue, 
prefix, 
suffix

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, 
newformat

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

email

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, 
showAction, 
addParam,
target, 
idName

baseLinkUrl is the link. 
showAction is an additional value which is added after the baseLinkUrl. 
addParam is an additional parameter that can be added after the idName property. 
target, if set, is added as an additional attribute. 
idName is the first parameter that is added after the showAction. By default, this is id,

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


keys: false,
editbutton : true, 
delbutton : true, 
editformbutton: false, 
onEdit : null, 
onSuccess: null, 
afterSave:null, 
onError: null, 
afterRestore: null, 
extraparam: {oper:'edit'}, 
url: null, 
delOptions: {}, 
editOptions : {} 

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,如需转载请自行联系原作者








上一篇:MyEclipse6.5 注释类及方法等格式设置(Code Templates)


下一篇:发布CLI|学习笔记