1.【准备】

我是在visual studio里面建立了一个asp.net MVC项目,然后导入ExtJS必要的包,然后写的。

ExtJS5.1版本下载:https://pan.baidu.com/s/1i3xKGhZ

建立项目详细可参考:http://www.docin.com/p-485498314.html

如何建立一个ExtJS页面:http://www.qeefee.com/article/000403

打开你的visual studio,新建一个web项目,选择建立一个MVC项目

然后选择MVC

然后就生成一个MVC项目啦,然后你根据我的目录结构,导入和命名一些文件夹【重点在(Script文件夹里面导入ExtJS部分)】

2.【效果图】

3.【代码】

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<script src="Scripts/Extjs/ext-all.js"></script>
<script src="Scripts/Extjs/packages/ext-locale/build/ext-locale-zh_CN.js"></script>
<script src="Scripts/Extjs/ux/app.js"></script>
<link href="Scripts/Extjs/packages/ext-theme-crisp/build/resources/ext-theme-crisp-all.css" rel="stylesheet" />
<!--<script type="text/javascript">
测试上面js,css文件是否连接进来用的
Ext.onReady(function () {
Ext.Msg.alert("hh", "welcome");
var win = new Ext.Window({ title: "hello", width: 200, height: 300, html: '<h1>ok....just a test....</h1>' });
win.show();
});
</script>--> <script type="text/javascript">
Ext.onReady(function () {
var addUserPanel = Ext.create('Ext.panel.Panel', { bodyStyle: 'padding:15px 15px 15px 0px',
style: { 'text-align': 'right' },//文字右靠
width: 430,
title: '添加用户',
tools: [{
type:'close',
}],
items: [ {
xtype: 'textfield',
fieldLabel: '账号',
width:'100%',
beforeLabelTextTpl: [
'<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
], }, {
xtype:'panel',
layout: 'column',
border: false, isFormField: true,
style:{'padding-bottom':'5px'},
items:[{ xtype: 'checkboxfield',
boxLabel: '账号有效期设置', // reference:'acc_validity',
columnWidth: .55,
style:{'padding-left':'105px','text-align':'left'}, }, {
xtype: 'datefield',
fieldLabel: '有效期:',
name:'a_validity',
format:'Y-m-d',
columnWidth: .45,
layout: 'form',
style: { 'float': 'left' },
labelWidth: 60,
disabled:true,//无效禁用效果 }
]}, {
xtype: 'textfield',
fieldLabel: '密码',
inputType: 'password',
width: '100%',
beforeLabelTextTpl: [
'<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
], }, {
xtype: 'textfield',
fieldLabel: '确认密码',
width: '100%',
inputType: 'password',
beforeLabelTextTpl: [
'<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
], }, {
xtype:'panel',
layout: 'column',//列布局
border:false,
isFormField: true,
style: { 'padding-bottom': '5px' },
items:[{
xtype: 'checkboxfield',
boxLabel: '密码有效期设置',
columnWidth: 0.55,//分到的列宽
layout: 'form',
style: { 'padding-left': '105px','text-align':'left' },
// width:150
}, {
xtype: 'spinnerfield',
fieldLabel: '有效期(天)',
minValue:'0',
maxValue:' 30',
value: '30',
columnWidth: 0.45,//分到的列宽
layout: 'form',
disabled: true,
//width: 200, }]
}, {
xtype: 'textfield',
fieldLabel: '工作单位',
width: '100%',
}, {
xtype: 'textfield',
fieldLabel: '邮箱',
vtype: 'email',//邮箱格式验证
width: '100%',
}, {
fieldLabel: '电话',
xtype: 'textfield',
width: '100%', }, {
xtype:'panel',
layout: 'column',
border:false,
isFormField: true, items:[{
fieldLabel: '姓',
xtype: 'textfield',
columnWidth: 0.55, labelWidth: 40, style: { 'padding-left': '60px','padding-bottom':'5px' }, }, {
fieldLabel: '名',
xtype: 'textfield',
columnWidth: 0.45, labelWidth: 40, }] }, {
fieldLabel: '用户角色',
xtype: 'combo',
width: '100%',
layout:'form',
beforeLabelTextTpl: [
'<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
],//左边出现“*” allowBlank: false,//不允许为空
blankText: '不能为空',//为空则提示
msgTarget: 'side',//警告在右边出现“!”
//设置为选项的text的字段
displayField: "Name",
//设置为选项的value的字段
valueField: "Id",
//选项数据
store: new Ext.data.SimpleStore({
fields: ['Id', 'Name'],
data: [[1, '男'], [0, '女']]
}) }, {
layout: "form",
border: false,
style: { 'padding-left': '100px', 'text-align': 'left' },
items:[{xtype: 'checkboxfield',
boxLabel: 'App权限', }, {
xtype: 'checkboxfield',
boxLabel: '启用',
checked: true, }] }, {
xtype: 'textarea',
fieldLabel: '备注',
width: '100%',
}
],
buttons: [{
text:'保存' }, {
text:'关闭',
}, ], renderTo: 'div' });
//主要是用于当数据不能为空时,显示“!”警告
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
}); </script>
</head>
<body>
<div id="div"></div>
</body>
</html>

 4.【资料】

无废话ExtJS系列教程:http://www.cnblogs.com/iamlilinfeng/category/910426.html

form跟column布局:http://hn2002.iteye.com/blog/520325

ExtJS一些控件属性:http://www.cnblogs.com/exmyth/archive/2013/04/12/3015827.html

ExtJS5学习笔记系列(这篇主要讲怎么添加重点符号*):http://blog.csdn.net/sushengmiyan/article/details/39395753

ExtJS4.0入门(对panel做了很详细的例子):http://www.doc88.com/p-788443516093.html 

整理以上,记录学习,也希望为后面的学习者提供一些有用的资料 

最新文章

  1. 【Java EE 学习 45】【Hibernate学习第二天】【对象的三种状态】【一对多关系的操作】
  2. Primer – 支撑 GitHub 的 CSS 工具包和准则
  3. MongoDB学习-在.NET中的简单操作
  4. 运行Python脚本的方法
  5. PHP使用DateTime类做时间日期到字符串转换
  6. asp.net webform javascript postback JSON
  7. Android ADB启动失败 ADB server out of date
  8. iOS开发网络篇—多线程断点下载
  9. 关于VS 2010 RDLC 报表的详细使用说明
  10. Mysql 学习记录
  11. Spring Security简明实践及相关国际化处理
  12. ES6躬行记(21)——类的继承
  13. HDU 1021 斐波那契
  14. Spring钩子方法和钩子接口的使用详解
  15. 国内常用的几个NTP时间服务器
  16. RocketMQ msgId生成算法
  17. struts2标签在jsp页面中构建map集合,循环显示
  18. Codeforces 934D - A Determined Cleanup
  19. 深入出不来nodejs源码-流程总览
  20. ReactJS实用技巧(1):JSX与HTML的那些不同

热门文章

  1. python+selenium自动化软件测试(第4章):场景判断与封装
  2. Spark Structured streaming框架(1)之基本使用
  3. 十条最有效的PCB设计黄金法则
  4. 点击grid单元格弹出新窗口
  5. selenium之handle学习 多窗口、句柄
  6. pip源相关问题
  7. [转]linux中颜色的含义
  8. 使用nginx实现纯前端跨越
  9. Git 入门篇
  10. ubuntu16.04下源码安装onos1.0.2