Tommy1969
20 Jun 2009, 10:53 PM
loadRecord や、setValues でフォームの初期化をしたいのですが、
radiogroup の中にあるラジオボタンには値が入らないようです。
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
<script type="text/javascript">
var simple = new Ext.FormPanel({
labelWidth: 75,
frame: true,
title: 'Simple Form',
width: 350,
defaults: {width: 230},
items: [
{xtype:'textfield', name: 'item1', fieldLabel: 'ITEM 1'},
{xtype:'radio', name: 'item2', fieldLabel: 'ITEM 2', boxLabel: 'V1', inputValue:1},
{xtype:'radio', name: 'item2', boxLabel: 'V2', inputValue:2},
{xtype:'radiogroup', fieldLabel: 'ITEM 3', items:[
{name: 'item3', boxLabel: 'VAL1', inputValue:1},
{name: 'item3', boxLabel: 'VAL2', inputValue:2},
]}
],
buttons: [
{text: 'Values', handler: function(btn, evt) {
var str = simple.getForm().getValues(true);
alert(str);
}}
]
});
Ext.onReady(function() {
simple.render(document.body);
simple.getForm().setValues({
item1: 'test',
item2: 2, // これは反映される。
item3: 2 // この値は反映されない…。(--;
});
});
</script>
</head>
<body>
</body>
</html>
やむを得ず、暫定的に getItem でラジオボタンを取得して…(略)…と、
別ロジックで値を埋め込む処理を実現しているのですが、他に良い手が
ありましたら、ご教示いただきたく…。
radiogroup の中にあるラジオボタンには値が入らないようです。
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
<script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
<script type="text/javascript">
var simple = new Ext.FormPanel({
labelWidth: 75,
frame: true,
title: 'Simple Form',
width: 350,
defaults: {width: 230},
items: [
{xtype:'textfield', name: 'item1', fieldLabel: 'ITEM 1'},
{xtype:'radio', name: 'item2', fieldLabel: 'ITEM 2', boxLabel: 'V1', inputValue:1},
{xtype:'radio', name: 'item2', boxLabel: 'V2', inputValue:2},
{xtype:'radiogroup', fieldLabel: 'ITEM 3', items:[
{name: 'item3', boxLabel: 'VAL1', inputValue:1},
{name: 'item3', boxLabel: 'VAL2', inputValue:2},
]}
],
buttons: [
{text: 'Values', handler: function(btn, evt) {
var str = simple.getForm().getValues(true);
alert(str);
}}
]
});
Ext.onReady(function() {
simple.render(document.body);
simple.getForm().setValues({
item1: 'test',
item2: 2, // これは反映される。
item3: 2 // この値は反映されない…。(--;
});
});
</script>
</head>
<body>
</body>
</html>
やむを得ず、暫定的に getItem でラジオボタンを取得して…(略)…と、
別ロジックで値を埋め込む処理を実現しているのですが、他に良い手が
ありましたら、ご教示いただきたく…。