123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- Ext.define('erp.view.common.search.Viewport', {
- extend : 'Ext.Viewport',
- layout : 'anchor',
- hideBorders : true,
- initComponent : function() {
- var me = this;
- me.callParent(arguments);
- me.add(me.createGrid([], []));
- },
- getColumns: function(fn) {
- var me = this;
- Ext.Ajax.request({
- url : basePath + 'common/singleGridPanel.action',
- params: {
- caller: caller,
- condition: ''
- },
- method : 'post',
- callback : function(opt, s, r){
- var res = new Ext.decode(r.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- if(res.columns){
- fn.call(me, res.columns, res.fields);
- }
- }
- });
- },
- createGrid: function(columns, fields) {
- Ext.define('Temp', {
- extend: 'Ext.data.Model',
- fields: fields
- });
- var store = Ext.create('Ext.data.Store', {
- model: 'Temp'
- });
- return Ext.create('Ext.grid.Panel', {
- anchor: '100% 100%',
- id : 'querygrid',
- cls : 'default-grid',
- maxDataSize: 30000,
- loadMask: true,
- plugins: 'bufferedrenderer',
- selModel: {
- pruneRemoved: false
- },
- viewConfig: {
- trackOver: true
- },
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- RenderUtil: Ext.create('erp.util.RenderUtil'),
- features : [{
- id: 'group',
- ftype: 'groupingsummary',
- hideGroupedHeader: true,
- enableGroupingMenu: false
- },{
- ftype: 'summary',
- dock: 'bottom'
- }],
- enableLocking : true,
- lockable : true,
- selModel: {
- selType: 'cellmodel'
- },
- columns: columns,
- store: store,
- columnLines: true,
- tbar: [{
- text: '筛选', iconCls: 'icon-find', name: 'find'
- },{
- text: '排序', iconCls: 'icon-sort', name: 'sort'
- },{
- text: '导出',
- iconCls: 'icon-xls',
- menu: [{text: '导出Excel (.xls)', iconCls: 'icon-xls', name: 'exportexcel'}, {text: '导出PDF (.pdf)', iconCls: 'icon-pdf', name: 'exportpdf'}]
- },{
- text: '锁定列',
- iconCls: 'icon-fixed',
- name: 'lock'
- }/*,{
- text: '公式',
- iconCls: 'icon-sum',
- menu: [{text: '总数', iconCls: 'icon-sum', name: 'sum'}, {text: '平均值', iconCls: 'icon-avg', name: 'average'}]
- }*/,{
- text: '分组',
- iconCls: 'icon-group',
- name: 'group'
- },'-',{
- xtype: 'tbtext',
- id: 'dataCount',
- hidden: true,
- tpl: Ext.create('Ext.XTemplate','为您找到 <strong>{count}</strong> 条数据')
- },'->',{
- iconCls: 'icon-maximize',
- text: '切换',
- menu: [{text: '最大化', name: 'max', iconCls: 'icon-maximize'},{text: 'Web Excel', name: 'webexcel', iconCls: 'icon-amp'}]
- },{
- text: '清除格式', iconCls: 'icon-remove',cls: 'custom-btn', name: 'removeformat'
- },{
- text: '清除数据', iconCls: 'icon-clear', name: 'clearall'
- },{
- text: '关闭', name: 'close', iconCls: 'icon-del'
- }]
- });
- }
- });
|