效果图如上:

页面代码:

 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查询实现的更多相关文章

  1. EXTJS4 Grid Filter 插件的使用 与后台数据解析------Extjs 查询筛选功能的实现

    先汗一个,一个小功能又踢腾了一天.本来这个带Demo的,但是上面介绍的不是很详细.用的时候问题不大,主要问题在文件导入方面.以为这个插件的使用和其他的不一样. 1.首先是需要引入文件的位置:如图 需要 ...

  2. Python开发入门与实战14-基于Extjs的界面

    14. 基于Extjs的界面 上一章我们实现了一个原生的html例子,本章我们将采用Extjs实现界面的展现,来说明MVC模式下我们是怎么考虑界面与业务层的关系的. 14.1. 引用Extjs目录 首 ...

  3. MongoDB的查询

    一.Find操作 二.分页和排序 三.游标的使用 一.Find查询 事前准备:插入如下数据 db.Students.insert([ { _id:1, name:"Zhao", a ...

  4. Extjs4.2 Grid搜索Ext.ux.grid.feature.Searching的使用

    背景 Extjs4.2 默认提供的Search搜索,功能还是非常强大的,只是对于国内的用户来说,还是不习惯在每列里面单击好几下再筛选,于是相当当初2.2里面的搜索,更加的实用点,于是在4.2里面实现. ...

  5. ExtJS 4.2 业务开发(二)数据展示和查询

    本篇开始模拟一个船舶管理系统,提供查询.添加.修改船舶的功能,这里介绍其中的数据展示和查询功能. 目录 1. 数据展示 2. 数据查询 3. 在线演示 1. 数据展示 在这里我们将模拟一个船舶管理系统 ...

  6. ExtJs 可查询的下拉框

    最近项目中有个需求,就是有四个模块需要加载一个主表的内容,比如说这个表叫项目表(比如项目表里有两个字段一个是项目ID--projCd,还有一个是项目名称--projNm).主表的内容的要放在一个下拉框 ...

  7. [ExtJS5学习笔记]第三十五节 sencha extjs 5 组件查询方法总结

    一个UI前台组件肯定会比较多,我们通常习惯性的使用ID来获取需要操作的组件,但是这种方法是extjs推荐的么?有没有extjs推荐使用的获取组件的方法呢? 目录 目录 extjs的查询组件的API 查 ...

  8. Extjs tree 过滤查询功能

    转载: http://blog.csdn.net/xiaobai51509660/article/details/36011899 Extjs4.2中,对于treeStore中未实现filterBy函 ...

  9. Extjs treePanel过滤查询功能【转】

    Extjs4.2中,对于treeStore中未实现filterBy函数进行实现,treestore并未继承与Ext.data.Store,对于treePanel的过滤查询功能,可有以下两种实现思路: ...

随机推荐

  1. UVA-10163 Storage Keepers DP

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  2. 【bzoj2654]】tree

    给白色边都加上一个值,二分这个值,使得选取的白边数量减少 #include<algorithm> #include<iostream> #include<cstdlib& ...

  3. hdoj--1379--DNA Sorting(排序水题)

     DNA Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  4. bzoj2705 [SDOI2012]Longge的问题——因数

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2705 一开始自己想了半天... 有了点思路:遍历 n 的因数 k,每个因数要预处理出 gcd ...

  5. bzoj4873

    http://www.lydsy.com/JudgeOnline/problem.php?id=4873 最大权闭合子图... 建图: 1.d[i][j]:i->j区间的费用,d[i][j] & ...

  6. bzoj4407

    http://www.lydsy.com/JudgeOnline/problem.php?id=4407 以前写过一次线性筛 发现不是很理解 写了个欧拉筛的 t了 其实每次推式子,都会先推出一组的解法 ...

  7. 使用Google的Closure Compiler,在本机上压缩javascript

    2011-12-05 13:47:39   1.JAVA JDK下载地址: http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-wi ...

  8. 15_传智播客iOS视频教程_OC语言完全兼容C语言

    OC支持C语言所有的运算符并且效果是一样的.C语言中所有的运算符OC都支持.这些所有的运算符OC当中全部都支持. 包括C语言的结构体.枚举全部都可以写在OC当中,没有任何问题,并且效果是一样的. 比如 ...

  9. $CF1153A\ Serval\ and\ Bus$

    看大佬的代码都好复杂(不愧是大佬\(orz\) 蒟蒻提供一种思路 因为求的是最近的车对吧\(qwq\) 所以我们可以用一个\(while\)循环所以没必要去用什么 \(for...\) 至于这是\(d ...

  10. 洛谷 P1414 又是毕业季II(未完成)

    题目背景 “叮铃铃铃”,随着高考最后一科结考铃声的敲响,三年青春时光顿时凝固于此刻.毕业的欣喜怎敌那离别的不舍,憧憬着未来仍毋忘逝去的歌.1000多个日夜的欢笑和泪水,全凝聚在毕业晚会上,相信,这一定 ...