Ext.onReady(function(){
Ext.QuickTips.init();
var arr=[ [1, '本.拉登'], [2, '笨.拉登'],[3, '笨.拉灯'] ];
var reader = new Ext.data.ArrayReader(
{id: 0},
[
{name: 'value'},
{name: 'key'}
]);
var store=new Ext.data.Store({
reader:reader
});
store.loadData(arr);
var htmleditor=new Ext.form.HtmlEditor({
fieldLabel:'htmleditor',
width:450,
fontFamilies:['宋体','隶书'],
name:'editor',
id:'editor'
});
var form = new Ext.FormPanel({
labelWidth: 75,
url:'post.php',
frame:true,
width: 800,
defaultType: 'textfield',
items: [
new Ext.form.Checkbox({ //checkbox
fieldLabel:'checkbox',
name:'cb',
checked:true,
boxLabel:'checkbox'
}),
new Ext.form.FieldSet({ //radio
border:false,
title:'radio',
items:[
new Ext.form.Radio({
labelSeparator:'',
name:'radio',
checked:true,
boxLabel:'radio 1'
}),
new Ext.form.Radio({
labelSeparator:'',
name:'radio',
checked:true,
boxLabel:'radio 2'
})
]
}),
new Ext.form.Hidden({ //hidden
name:'hidden'
}),
htmleditor,
new Ext.form.TextField({ //text
fieldLabel:'text',
name:'text',
grow:true,
allowBlank:false,
blankText : "这个字段最好不要为空",
msgTarget:'under',
maskRe:/[a-zA-z]/gi
}),
new Ext.form.NumberField({ //NumberField
allowNegative:true,
fieldLabel:'number',
name:'number'
}),
new Ext.form.TextArea({ //TextArea
fieldLabel:'textarea',
name:'textarea'
}),
new Ext.form.TriggerField({ //TriggerField
fieldLabel:'TriggerField',
name:'TriggerField'
}),
new Ext.form.ComboBox({ //select
fieldLabel:'select',
editable:false,
triggerAction: 'all',
valueField:'value',
displayField:'key',
mode: 'local',
store:store
}),
new Ext.form.ComboBox({ //combobox
fieldLabel:'ComboBox',
displayField:'key',
mode: 'local',
store:store
}),
new Ext.form.DateField({ //DateField
fieldLabel:'DateField',
format:'Y-m-d',
disabledDays:[0,6]
}),
new Ext.form.TimeField({//TimeField
fieldLabel:'TimeField',
mode: 'local',
increment:60
})
]
});
form.render(document.body);
htmleditor.setRawValue("<h1>hello world</h1>");
htmleditor.syncValue();
});