Extjs-form实例:
1。Ext.onReady(function(){
var form = new Ext.form.FormPanel({
defaultType: 'textfield',
labelAlign: 'right',
title: 'form',
labelWidth: 50,
frame: true,
width: 220,
items: [{
fieldLabel: '文本框'
}],
buttons: [{
text: '按钮'
}]
});
form.render("form");
});
2。Ext.onReady(function() {
var form = new Ext.form.FormPanel({
labelWidth: 55,
defaultType: 'textfield',
items: [{
fieldLabel: 'Send To',
name: 'to',
anchor:'100%' // anchor width by percentage
},{
fieldLabel: 'Subject',
name: 'subject',
anchor: '100%' // anchor width by percentage
}, {
xtype: 'textarea',
hideLabel: true,
name: 'msg',
anchor: '100% -53' // anchor width by percentage and height by raw adjustment
}]
});
var window = new Ext.Window({
title: 'Resize Me',
width: 500,
height:300,
minWidth: 300,
minHeight: 200,
layout: 'fit',
plain:true,
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: form,
buttons: [{
text: 'Send'
},{
text: 'Cancel'
}]
});
window.show();
});
3。var store = new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : exampleData
});
var combo = new Ext.form.ComboBox({
store: store,
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
applyTo: 'local-states'
});