论坛首页 Web前端技术论坛

使用 Ext Grid paging插件

浏览 1991 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-06-09  
FactoryListGridPanel = function(viewer, config) {
    this.viewer = viewer;
    Ext.apply(this, config);
    this.httpProxy = new Ext.data.HttpProxy({
		//url : '/erw/server/base/busilist_Array_Ext.jsp?json=' + pageparam.busiobj
		url : '/erw/server/base/busilist_Array_Ext.jsp'
	});
	
	var title = pageparam.title;
	var defines = pageparam.defines;
	this.busi = pageparam.businame;
	this.loadColumns(defines,pageRowCount);
	
	var pagingBar = new Ext.PagingToolbar({
		plugins : new Ext.ux.grid.PageSizePlugin(),
		pageSize: pageRowCount,
		store: this.store,
		displayInfo: true
    });
    
    this.pagingBar = pagingBar;
    
    var sm = new Ext.grid.CheckboxSelectionModel({
        listeners: {
           beforerowselect : function (sm, rowIndex, keep, rec) {
	          
	          }
    	},
    	onMouseDown : function(e, t){
	        if(e.button === 0){
	        }
    	}
    });
    
    FactoryListGridPanel.superclass.constructor.call(this, {
        region: 'center',
        id: 'basefactory-grid',
        margins:'2 2 2 2',
        loadMask: {msg:title},
        enableDragDrop: true,
 		sm: sm,
        enableColumnHide:false,
       viewConfig: {
            forceFit:true,
            enableRowBody:true,
            showPreview:true
          // , getRowClass : this.applyRowClass
        },
        //autoExpandColumn:4,
        bbar:pagingBar
    });
   
   
	this.insertWin.on("submit" , this.onInsertWinSubmit , this) ;
		
	this.updateWin.on("submit" , this.onUpdateWinSubmit , this) ;
	
	
};

Ext.extend(FactoryListGridPanel, Ext.grid.GridPanel, {
		busi :"",
		insertWin:new InsertFactoryInfoWindow(),
		updateWin:new UpdateFactoryInfoWindow(),
		loadColumns : function ( ataglist  ,apageSize)
		    {
			var cmarray = [new Ext.grid.RowNumberer(),new Ext.grid.CheckboxSelectionModel()];
			var rdarray = [];
			if (ataglist)
			{
				for (var i=0;i<ataglist.length;i++)
				{
					var cmobj = {};
					var rdobj = {};
					
					var oname = ataglist[i];
					if (typeof(oname)=='object')
					{
						cmobj.header = oname.name;
						cmobj.dataIndex = oname.name;
						if (oname.width) cmobj.width = oname.width * 1;
						if (oname.id) cmobj.id = oname.id;
						if (oname.hidden) cmobj.hidden = oname.hidden;
						rdobj.name = oname.name;
						if(oname.name=="操作") cmobj.renderer = function (value,met){
							var grid = Ext.getCmp("basefactory-grid");
							return "<span style=cursor:hand; onclick=grid.openWindow()><font color=red>修改</font></span>"
							};
					}
					else
					{
						cmobj.header = oname;
						cmobj.dataIndex = oname;
						cmobj.width =120;
						rdobj.name = oname;
					}
					
					cmobj.sortable = true;
					cmarray.push(cmobj);
					rdarray.push(rdobj);
				}
			}
			
			if (rdarray.length>0){
				this.reader = new Ext.data.ArrayReader({
												root:"rows",
												totalProperty  :"count"
										   },rdarray)
			}
			
			var cjson = Ext.util.JSON.encode(pageparam.busiobj);
			
			this.store = new Ext.data.Store({
					autoLoad :{params : {start : 0,limit : apageSize}},
					baseParams: {json:cjson},
				    proxy: this.httpProxy,
				    reader : this.reader
			    });
				
			    this.columns = cmarray;
		    }
	
	
	})[color=red][/color]
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics