- var grid = Ext.create('Ext.grid.Panel', {
- border: true,
- stripeRows: true,
- columns: [
- { xtype: 'rownumberer' },
- { text: '学期', dataIndex: 'schoolTerm', align: 'center', flex: 1 }
- ],
- selModel: sm,
- store: studentStore,
- columnLines: false,
- loadMask: { msg: '数据加载中,请稍候...' },
- listeners: {
- //添加排序改变事件
- p; sortchange: function (ct, column, direction, eOpts) {
- var title = column.textEl.getHTML();//获取列表头的文本
- if (title == "学期") {
- var sortType = Ext.util.Format.uppercase(direction);//获取排序方式“DESC”或“ASC”
- if ("DESC" == sortType) {
- studentStore.sort('schoolTermId', 'DESC');
- } else {
- studentStore.sort('schoolTermId', 'ASC');
- }
- studentStore.load({//加载数据
- scope: this,
- callback: function (records, operation, success) {
- var responseData = studentStore.getProxy().getReader().rawData;
- if (typeof (responseData) == "undefined") {
- return;
- }
- var responseMsg = responseData.msg;
- var responseFlag = responseData.success;
- if (responseFlag != null && responseFlag == false) {
- Ext.Msg.alert('温馨提示', '您好,查询信息失败!' + responseMsg);
- }
- }
- });
- }
- }
- }
- });
- 来源:http://blog.csdn.net/hsg0123_126/article/details/38320969