`
mimang2007110
  • 浏览: 232313 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

GridPanel通过Ajax动态加载数据显示到页面

阅读更多
//创建查询对象
		var gridStore = new Ext.data.JsonStore( {
			url : "../../service/vip/query.action",
			autoLoad : false,
			pruneModifiedRecords : true,
			fields : [ 'IMSI', 'MSISDN', 'zjshcount'],
			root : 'data',
			method : 'POST'
		});
		
		//数据加载
		gridStore.load();

		//创建表格对象,显示查询出来的数据
		var grid = new Ext.grid.GridPanel( {
			el : "gridDiv",
			store : gridStore,
			columns : [ 
				{id : 'IMSI', header : 'IMSI', dataIndex : 'IMSI', sortable : true},
				{id : 'MSISDN', header : 'MSISDN', dataIndex : 'MSISDN', sortable : true},
				{id : 'zjshcount', header : '主叫试呼次数', dataIndex : 'zjshcount', sortable : true}
			],
			viewConfig : {
				forceFit : true
			},
			autoHeight : true,
			width : 900
		});
		
		//加载到页面
		grid.render();

 

//带参数的后台访问加载
//点击查询按钮后根据查询条件加载查询结果
				grid.getStore().load( {
					params : {
						starttime : starttimeValue,
						endtime : endtimeValue,
						type : type_comboBox.getValue(),
						province : province.getValue(),
						city : city.getValue(),
						zdvip : zdvip.checked,
						continutime : continutime.getValue(),
						continutime2 : continutime2.getValue(),
						opc : opc.getValue(),
						opc2 : opc2.getValue()
					},
					callback : function(r, options, success) {
						if (success) {						
							//加载成功后显示到页面
							grid.render();
						} else {
							Ext.Msg.alert('友情提示', '数据查询异常');
						}
					}
				});

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics