Sencha Touch 2.0 Form表单示例
2012-04-01 09:25
471 查看
Step 1: 首先声明定义一个FormPanel,如下:
Step 2: 现在给这个FormPanel加上标题栏
Step 3: 添加表单组件,这里只列出SenchaTouch提供的部分组件,其余的可参考api,http://docs.sencha.com/touch/2-0/
Step 4: 上面已经声明了一个FormPanel,接下来就使用这个表单
这样子,一个简单的表单就创建好了。运行结果如下:演示
Ext.define('FormPanel', { extend: 'Ext.Panel', config: {} });
Step 2: 现在给这个FormPanel加上标题栏
Ext.define('FormPanel', { extend: 'Ext.Panel', config: { fullscreen: true,//设置全屏 scrollable: { direction: 'vertical'//设置允许垂直滚动 }, padding: 10, items:[{ xtype: 'titlebar',//标题栏 title: 'Form Demo',//标题 docked: 'top'//位置,top表示顶部 }] } });
Step 3: 添加表单组件,这里只列出SenchaTouch提供的部分组件,其余的可参考api,http://docs.sencha.com/touch/2-0/
Ext.define('FormPanel', { extend: 'Ext.Panel', config: { fullscreen: true,//设置全屏 scrollable: { direction: 'vertical'//设置允许垂直滚动 }, padding: 10, items: [{ xtype: 'fieldset', defaults: { xtype: 'textfield'//设置默认组件类型为文本域 }, items: [{ label: 'Firstname', name: 'firstname' }, { label: 'Secondname', name: 'secondname' }, { xtype: 'datepickerfield',//日期选择域 label: 'Birthday', name: 'birthday', value: new Date() }, { xtype: 'togglefield',//开关组件 label: 'Gender', value: 1 }, { xtype: 'checkboxfield',//复选框组件 label: 'Favorite', value: 1 }, { xtype: 'textareafield',//多行文本域 label: 'Description', name: 'description' }] }, { xtype: 'panel', layout: 'hbox', items: [{ xtype: 'button', flex: 1, text: 'Submit', ui: 'decline' }, { xtype: 'button', flex: 1, text: 'Cancel', ui: 'confirm' }] }, { xtype: 'titlebar',//标题栏 title: 'Form Demo',//标题 docked: 'top'//位置,top表示顶部 }] } });
Step 4: 上面已经声明了一个FormPanel,接下来就使用这个表单
Ext.application({ launch: function(){ Ext.create('FormPanel'); } });
这样子,一个简单的表单就创建好了。运行结果如下:演示
相关文章推荐
- Sencha Touch 2 学习笔记(三)----Form表单容器及其子组件
- Infopath Form Service示例:如何在InfoPath表单中引用SQL SERVER 中的数据?
- 使用jquery.form.js实现form表单无刷新提交简单示例
- Sencha touch 2.0 + phone gap 1.2 + android 4.0 集成
- jQuery formValidator表单验证插件开源了!!含API帮助、源码、示例
- Sencha Touch 2.0 威老的自定义组件:CardPanel
- Yii Framework2.0开发教程(2)使用表单Form
- Sencha Touch 2.0 有哪些新特征?
- Sencha Touch 2.0官方指南:如何使用组件
- Sencha touch2.0 IIS 配置
- form表单数据 转json 对象最佳示例
- xcode4.3.1 phonegap环境下开发sencha touch 2.0
- Jq form表单提交验证与响应简单示例
- YII2.0之Activeform表单组件用法实例
- sencha touch 2 Form动态提交
- EasyUI中实现form表单提交的示例分享
- Sencha Touch 快速入门2.0 第一章 开发Sencha Touch App
- 采取枚举,form表单请求取值方法示例
- 使用extJs 2.0的form提交表单(非AJAX方式)