论坛首页 Web前端技术论坛

原jqGrid控件表格数据清空后怎么重新加载数据

浏览 15345 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2012-01-01   最后修改:2012-01-01

页面初始化通过以下脚本加载客户相关数据,以下是主要代码

 

$(window).load(function(){		
	loadData(<%= fItemID %>,<%= useTemConfig %>,false);
			
		});
 
function loadData(fItemID,tem,flag) {
	//flag: true 查询下级客户明细
	//flag: false 默认查询上级客户汇总明细
	
	$("#gridlist").jqGrid({					
					url:"customer-grade-detail.jsp?fItemID=" + fItemID + "&tem=" + tem + "&flag=" + flag,
					datatype: "json",
					colNames:['日期', '客户代码', '信用额度','销售金额(当天)','收款金额(当天)','退货金额(当天)','销售金额(累计)','收款金额(累计)',
                                                          退货金额(累计)','应收款金额', '利息', '利息(累计)','年平均欠款率', '年最高欠款率', '年终欠款率', '客户得分', '等级'],
					colModel:[
						{name:'date',index:'date', width:100, align:"center", frozen:true},
						{name:'FNumber',index:'FNumber', width:120, sortable:false, align:"right", frozen:true, sortable:false},
						{name:'credit',index:'credit', width:100, align:"right", formatter:"currency"},
						{name:'sale',index:'sale', width:120, align:"right", formatter:"currency"},		
						{name:'collectedAmount',index:'collectedAmount', width:120,align:"right", formatter:"currency"},		
						{name:'saleReturn',index:'saleReturn', width:120, align:"right", formatter:"currency"},		
						{name:'saleTotal',index:'saleTotal', width:120, align:"right", formatter:"currency"},		
						{name:'saleReturnTotal',index:'saleReturnTotal', width:120, align:"right", formatter:"currency"},		
						{name:'collectedAmountTotal',index:'collectedAmountTotal', width:120, align:"right", formatter:"currency"},		
						{name:'dueAccount',index:'dueAccount', width:120, align:"right", formatter:"currency"},		
						{name:'accrual',index:'accrual', width:100, align:"right", formatter:"currency"},		
						{name:'accrualTotal',index:'accrualTotal', width:100, align:"right", formatter:"currency"},		
						{name:'averageRate',index:'averageRate', width:100, align:"right"},		
						{name:'highRate',index:'highRate', width:100, align:"right"},		
						{name:'finalRate',index:'finalRate', width:100, align:"right"},		
						{name:'point',index:'point', width:100, align:"right", formatter:"number"},		
						{name:'grade',index:'grade', width:50, align:"center"}
					],
					jsonReader: {
						repeatitems: false
					},  
					height:300,
					rowNum:1000,
					//rowList:[2,20,30],
					pager: '#pager2',
					hidegrid: false,
					loadtext: "数据加载中...",
					autowidth: true,
					rownumbers: true,
					shrinkToFit: false,
					sortname:'date',  
					sortorder:'asc', 
					viewrecords: true,
					caption:"客户等级明细"
				}).jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
}

 效果图如下

 

现在想要通过更改右上下拉菜单值  并在gird表格中显示其下级客户数据

 

//加载下级客户
function changeChild(fItemID,tem) {		
	$("#gridlist" ).clearGridData();   //清空原grid数据
	loadData(fItemID,tem,true);	
	
}

 用以上脚本无效,我的想法是先清空原有数据,再重新通过 loadData(), 为什么会没有无效,谢谢了

  • 大小: 192.2 KB
论坛首页 Web前端技术版

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