Extjs查询实现

效果图如上:
页面代码:
Ext.QuickTips.init(); //放在图标上会自动提示信息
Ext.define('ExtApp.view.StudentList' , {
extend : 'Ext.grid.Panel' ,
id : 'StudentListGrid' ,
xtype : 'StudentList' ,
store : 'StudentList' ,
draggable:false, //设置为false则禁用拖拽改变列顺序、
columnLines:true,//添加列的框线样式
viewConfig: {
stripeRows:true //True来实现隔行换颜色
},
tbar : [{
xtype : 'form',
id : 'queryFormSL' ,
width : '100%',
items : [{
xtype : 'container',
padding : 5,
flex : 2,
layout : {
type : 'hbox'
},
items : [{
labelWidth : 60,
labelAlign : 'right',
width: 200,
xtype : 'combo',
fieldLabel:'选择年级',
name:'gradeCode',
id : 'cobStudentListGradeCode',
store : 'Grade',
valueField : 'gradeCode',
displayField : 'gradeName',
editable : false,
emptyText : '请选年级',
queryMode : 'local'
},{
xtype : 'textfield',
labelSeparator:':',
labelWidth : 150,
width: 300,
labelAlign : 'right',
id:'SListTextField',
name:'userNameORuserCode',
fieldLabel : '输入学生ID或学生姓名'
},{
xtype : 'button',
id : 'btnStuListQuery',
text : '查询'
},{
xtype : 'button',
id : 'btnStuListReset',
text : '重置'
}]
}]
}],
columns : [
{ xtype:'rownumberer',text:'序号',flex:1, align:'center'},
{ text:'账户ID' , flex:2 , align:'center' , dataIndex:'userCode' },
{ text:'用户姓名' , flex:1 , align:'center' , dataIndex:'userName'},
{ text:'性别' , flex:1 , align:'center' , dataIndex:'sex' },
{ text:'城市' , flex:1 , align:'center' , dataIndex:'cityName' },
{ text:'学校' , flex:1 , align:'center' , dataIndex:'schoolName'},
{ text:'年级号' , flex:1 , align:'center' , dataIndex:'gradeCode'},
{ text:'联系电话' , flex:2 , align:'center' , dataIndex:'tel'},
{ text:'邮箱' , flex:2 , align:'center' , dataIndex:'email'},
{ text:'QQ' , flex:2 , align:'center' , dataIndex:'qq'},
{ header:'账户注册时间',align:"center",flex:3,dataIndex:'firstAccessDate',xtype:'datecolumn',format:'Y-m-d H:i:s'},
{ header: '详细信息' ,
xtype: 'actioncolumn' ,
width: 50 ,
flex : 1 ,
align:'center',
items: [{
icon: 'images/grid.png' ,
tooltip: '详细信息' ,
handler: function(grid, rowIndex, colIndex){
var record = grid.getStore().getAt(rowIndex);
var win = Ext.create('ExtApp.view.StudentDetails').show();
var form = win.down('form').getForm();
form.loadRecord(record);
}
}]
}
],
dockedItems:[{
xtype: 'pagingtoolbar',
store : 'StudentList' , // GridPanel中使用的数据
dock: 'bottom',
displayInfo: true
}]
});
点击"查询"按钮触发事件:
StuListQuery:function(btn,event){
var store=this.getStore('StudentList');
var form=btn.up('form[id=queryFormSL]');
var grid=form.up('grid[id=StudentListGrid]');
//var grid=Ext.getCmp('StudentListGrid');
var pageBar = grid.down('pagingtoolbar');
var userNameORuserCode=form.getForm().getValues()['userNameORuserCode']; //form.getForm.getValues()返回的是一个数组
var gradeCode = form.getForm().getValues()['gradeCode'];
store.setProxy({
type:'ajax',
actionMethods:{
read:'POST'
},
url:'queryStudent.action',
extraParams:{'userNameORuserCode':userNameORuserCode,
'gradeCode':gradeCode
},
reader:{
type:'json',
root: 'rows',
totalProperty: 'results'
}
});
pageBar.moveFirst();
},
Extjs中找Form,Extjs找组件的方式:
1,Extjs.getCmp
2,通过组件之间的关系,up,down
Extjs查询实现的更多相关文章
- EXTJS4 Grid Filter 插件的使用 与后台数据解析------Extjs 查询筛选功能的实现
先汗一个,一个小功能又踢腾了一天.本来这个带Demo的,但是上面介绍的不是很详细.用的时候问题不大,主要问题在文件导入方面.以为这个插件的使用和其他的不一样. 1.首先是需要引入文件的位置:如图 需要 ...
- Python开发入门与实战14-基于Extjs的界面
14. 基于Extjs的界面 上一章我们实现了一个原生的html例子,本章我们将采用Extjs实现界面的展现,来说明MVC模式下我们是怎么考虑界面与业务层的关系的. 14.1. 引用Extjs目录 首 ...
- MongoDB的查询
一.Find操作 二.分页和排序 三.游标的使用 一.Find查询 事前准备:插入如下数据 db.Students.insert([ { _id:1, name:"Zhao", a ...
- Extjs4.2 Grid搜索Ext.ux.grid.feature.Searching的使用
背景 Extjs4.2 默认提供的Search搜索,功能还是非常强大的,只是对于国内的用户来说,还是不习惯在每列里面单击好几下再筛选,于是相当当初2.2里面的搜索,更加的实用点,于是在4.2里面实现. ...
- ExtJS 4.2 业务开发(二)数据展示和查询
本篇开始模拟一个船舶管理系统,提供查询.添加.修改船舶的功能,这里介绍其中的数据展示和查询功能. 目录 1. 数据展示 2. 数据查询 3. 在线演示 1. 数据展示 在这里我们将模拟一个船舶管理系统 ...
- ExtJs 可查询的下拉框
最近项目中有个需求,就是有四个模块需要加载一个主表的内容,比如说这个表叫项目表(比如项目表里有两个字段一个是项目ID--projCd,还有一个是项目名称--projNm).主表的内容的要放在一个下拉框 ...
- [ExtJS5学习笔记]第三十五节 sencha extjs 5 组件查询方法总结
一个UI前台组件肯定会比较多,我们通常习惯性的使用ID来获取需要操作的组件,但是这种方法是extjs推荐的么?有没有extjs推荐使用的获取组件的方法呢? 目录 目录 extjs的查询组件的API 查 ...
- Extjs tree 过滤查询功能
转载: http://blog.csdn.net/xiaobai51509660/article/details/36011899 Extjs4.2中,对于treeStore中未实现filterBy函 ...
- Extjs treePanel过滤查询功能【转】
Extjs4.2中,对于treeStore中未实现filterBy函数进行实现,treestore并未继承与Ext.data.Store,对于treePanel的过滤查询功能,可有以下两种实现思路: ...
随机推荐
- [翻译角]Learn From George, Not Pinocchio(ESLPOD)
以下转自www.eslpod.com,翻译为本人添加.其余版权均归原网站所有. ESLPOD是一个英语学习网站,我最初知道这个网站,是因为“奶爸”<把你的英语用起来>一书的推荐. ESLP ...
- 洛谷 P1383 高级打字机==codevs 3333 高级打字机
P1383 高级打字机 18通过 118提交 题目提供者yeszy 标签倍增图论高级数据结构福建省历届夏令营 难度省选/NOI- 提交该题 讨论 题解 记录 最新讨论 暂时没有讨论 题目描述 早苗入手 ...
- ssh服务常见问题及其解决办法
1 统一解决办法 执行sshd -t,这样就可以指出是哪里出问题了. 所有的服务都应该有这个测试选项,否则出错了都不知道在哪里出的问题. 2 root用户登录,密码是对的,但是报“Permission ...
- office文档、图片、音/视频格式转换工具
1.音频/视屏转换工具VLC https://wiki.videolan.org/Mp3/#Container_formats http://wenku.baidu.com/view/ba73ac5 ...
- python安装了2.7之后终端无法使用退格,上下左右
遇到RT问题,原因是由于在编译python的时候去烧readline库造成的 解决办法: yum install readline-devel 然后重新编译安装python,终端控制符可用!
- [RK3288][Android6.0] 调试笔记 --- 录音音量从HAL到APP层会变小问题【转】
本文转载自:http://blog.csdn.net/kris_fei/article/details/72783843?locationNum=9&fps=1 Platform: Rockc ...
- 蓝书4.1-4.4 树状数组、RMQ问题、线段树、倍增求LCA
这章的数据结构题很真实 T1 排队 bzoj 1699 题目大意: 求静态一些区间的最大值-最小值 思路: ST表裸题 #include<iostream> #include<cst ...
- IntelliJ IDEA 缓存和索引介绍
转自:https://www.cnblogs.com/zhanghaibinblogs/p/6722061.html IDEA 在首次加载项目的时候都会创建索引,IDEA 的缓存和索引主要是用来加快文 ...
- codemirror插件-文件比较组件merge
目的: 为了实现文件比较功能 引用文件 从github下载项目后,从以下路径引用文件,其中部分github分支中codemirror.js 需要运行项目,自动合成 <link rel=style ...
- NestedPreb
屌丝手动版 One of the things we’re sorely missing from Unity is nested prefabs. So we rolled this little ...