Grails和Extjs整合中的类型转换汇总

效果:

[img]http://dl.iteye.com/upload/attachment/454418/6e16529b-9a61-3f9a-9036-0161a42957aa.png[/img]


[list]
[*] string
无需转换
[*] string inList
{fieldLabel: '${cgDomainProperties.string2.chinese}',name: 'string2',xtype: 'combo',store: new Ext.data.SimpleStore({ fields:['values'], data:[['选择1'],['选择2'],['选择3']]}), emptyText:'请选择${cgDomainProperties.string2.chinese}',mode: 'local', triggerAction: 'all', valueField: 'values', displayField: 'values'},
[*] Date
Form:{fieldLabel: '${cgDomainProperties.date1.chinese}',name: 'date1',xtype:'datefield',format:'Y-m-d'},
Controller: book.date1=(new java.text.SimpleDateFormat("yyyy-MM-dd")).parse(params.date1)
同时将:Config.groovy中添加[color=red]grails.converters.json.date= 'javascript'[/color]
[*] int
Form:{fieldLabel: '${cgDomainProperties.ingeger1.chinese}',name: 'ingeger1',xtype:'numberfield'},
Controller: book.ingeger1=params.ingeger1.toInteger()
[*] float
Form:{fieldLabel: '${cgDomainProperties.float1.chinese}',name: 'float1',xtype:'numberfield',allowDecimals:true},
Controller: book.float1=params.float1.toFloat()
[*] boolean
Form: {boxLabel: '${cgDomainProperties.boolean1.chinese}',name: 'boolean1',xtype:'checkbox'}
book.boolean1=params.boolean1?true:false
[/list]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值