Ext.define('ZYMLZiYuanModel', { extend: 'Ext.data.Model', fields:list }); var ZYMLZiYuanStore = new Ext.data.Store({ autoDestroy: true, pageSize: 20, model: 'ZYMLZiYuanModel', proxy: { type: 'ajax', url: '/res/ZiYuan/BaseLeftSourceShuJu?resourceid='+resourceid, reader: { root: 'topics', totalProperty: 'totalCount' }, simpleSortMode: true }, remoteSort: true }); var formdata = {}; Ext.onReady(function () { Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); Ext.tip.QuickTipManager.init(); Ext.Ajax.timeout = 900000; Ext.require([ 'Ext.ux.PagingToolbar' ]); Ext.create('Ext.grid.Panel', { id: 'gridexample', renderTo: 'grid', // width: 2400, // height: 750, layout: 'fit', autoScroll: false, //bodyStyle: 'width:100%', store: ZYMLZiYuanStore, stateful: false, stateId: 'ZYMLZiYuan-Grid', viewConfig: { forceFit: true, enableTextSelection: true //列表数据可复制 }, columns:columns , bbar: Ext.create('Ext.ux.PagingToolbar', { id: "Page", name: "Page", store: ZYMLZiYuanStore, displayInfo: true, firstText: "首页", prevText: "上一页", nextText: "下一页", lastText: "尾页", refreshText: '刷新', beforePageText: '第', afterPageText: '页,共 {0} 页', displayMsg: '显示 {0} - {1} 条,共 {2} 条', emptyMsg: "没有数据显示", items: [ { xtype: 'label', text: '' } ] }) }); ZYMLZiYuanStore.on('beforeload', function () { GetSearchWhere("SearchForm"); ZYMLZiYuanStore.proxy.extraParams = []; Ext.apply(ZYMLZiYuanStore.proxy.extraParams, formdata); }); ZYMLZiYuanStore.on('load', function (store, records, successful, eOpts) { // var totalCount = store.totalCount; // if (totalCount == "") totalCount = "0"; }); ZYMLZiYuanStore.load(); //添加resize监听防止切换tab或者收起左栏导致grid不自适应宽度 $(window).resize(function () { Ext.getCmp('gridexample').doLayout();//panel重新布局 }); }); /*