var simulationSupportList=[];
var sortIconIdArr=[];
var typeAr = ['asc','desc'];
var RefSortByLogon;
var RefSortByLogonType;
var RefSortByLogonId;
var Refurl='';
var urlForRefresh=null;
var totalPage = 1;
var totalRecords;
var totalPageNo;
var glUrl;
var gridMsg = '';
var pagesizec = 0;
var startIn = 1;
var endIn = 10;
var key="";
var sortState="";
var DirProperty="";
var gCombo="";
var isGCombo=false;
var temColName="";
var temDispName="";
var temDT="";
var dashboardNameT="";
var compType="";

function isHyphen(str) {
	if(str != null && str != undefined && str == '-')
		return -2;
	else
	   return -1;
}
Ext.Loader.setConfig		({
	enabled: true,
	disableCaching: false,
	paths: {
        "Ext.ux": "/final/scripts/ux",
		"utilities": "/final/scripts/utilities"
    }
});
Ext.define('GeneralMeasuresGridPanel', {
	extend: 'Ext.panel.Panel',
	alias:'widget.generalMeasuresGridPanel',
	id:'perPanel',
	url:"",
	border:false,
	frame:false,
	layout:{
		type:'vbox',
		align:'stretch'
	},
	flex:1,
	someFun:Ext.emptyFn,
	style:{'z-index':'0 !important'},
	entireData:null,
	entireOrgData:null,
	totalRecords:null,
	totalPageNo:null,
	pagesize:null,
	sort:'asc',
	height:490,
	/*listeners:{
		'afterrender':function(panel){
			var panelHeight=0;
			if(panel.isFormHide)
			{
				panelHeight=Ext.getBody().getViewSize().height-70;
			}
			else
			{
				panelHeight=Ext.getBody().getViewSize().height-150;
			}
			heightinit=panelHeight;
			panel.setHeight(panelHeight);
		},
		'resize':function(panel){
			var panelHeight=0;
			if(panel.isFormHide)
			{
				panelHeight=Ext.getBody().getViewSize().height-70;
			}
			else
			{
				panelHeight=Ext.getBody().getViewSize().height-150;
			}
			heightinit=panelHeight;
			panel.setHeight(panelHeight);
		}
	},*/
	//bodyCls:'general-dashboard-grid-panel',
	screenLabelPath:"",
	loadTab:function(url,totalRecords,pageNo,totalPageNo,fromMetricView,noMaskFlag,dashboardName){
		if(dashboardName != undefined && dashboardName != null)
			dashboardNameT = dashboardName;
		else
			dashboardNameT = 'otherDashboard';
		var me = this;
		var myMask = null;
		if(!Ext.isEmpty(me))
		{
			myMask = new Ext.LoadMask(me, {msg:"Please wait..."});
			try
			{
				if(Ext.isEmpty(noMaskFlag) || !noMaskFlag)
					myMask.show();				
			}
			catch (er)
			{
				myMask.show();
			}
			
		}

		if(Ext.isEmpty(url))			// Prem
			url = this.url;
		
		if(url!=null && url.indexOf("/final/monitor/endUserDashboard")==-1)
		{
			var componentTypCombo = Ext.getCmp('componentTypCombo');
			if(!Ext.isEmpty(componentTypCombo))
				componentTypComboVal = componentTypCombo.value;
			if(!Ext.isEmpty(compSelectedValue) && Ext.isEmpty(componentTypComboVal))
			{
				if(!Ext.isEmpty(url) && url.indexOf("appCurrentHost") > -1)
				{
					var updateUrl = url.split("&");
					var newUrl="";
					for(var i=0;i<updateUrl.length;i++)
					{
						var name = updateUrl[i];
						if(name.indexOf("appCurrentHost") > -1)
						{
							var value = name.substring(name.indexOf("=")+1,name.length);
							name = 'appCurrentHost='+compSelectedValue;
						}
						newUrl = newUrl+name+"&";
					}
					url = newUrl;
				}
				else
				{
					url = url+'&appCurrentHost='+compSelectedValue;
				}
			}
		}

		glUrl=url;
		if(pageNo == null || pageNo == undefined || pageNo =='')
			pageNo='1';
		urlForRefresh=url;

		if(pageNo=='1')
		{
			Ext.Ajax.request({
			url : url,
			scope:this,
			timeout:280000,
			success: function(response)
			{
				var jsonText = response.responseText;
				var jsonData = Ext.decode(jsonText);
				var ary=[],aryIndex=0,maxLength=0;
				if(!Ext.isEmpty(jsonData) && !Ext.isEmpty(jsonData.measures) && jsonData.measures!="undefiend")
				{
					try
					{
						if(dashboardNameT == 'SystemList')
						{
							var differVal = '';
							if(!Ext.isEmpty(jsonData.componentTypeOptions))
								differVal += jsonData.componentTypeOptions.selectedComponentType+'-';
							if(!Ext.isEmpty(jsonData.pageParams.selectedSubFilterOption))
								differVal += jsonData.pageParams.selectedSubFilterOption+'-';
							if(!Ext.isEmpty(jsonData.pageParams.selectedFilterByOption))
								differVal += jsonData.pageParams.selectedFilterByOption;
							
							compType= differVal;
						}
						else if(dashboardNameT == 'comparisonDashboard')
						{
							if(jsonData.externalAgentObj.selectedextAgentType != undefined)
								compType=jsonData.externalAgentObj.selectedextAgentType;
							else if(len  > 2 )
								compType='all';
							else 
								compType='Not Applicable';
						}
						else
						{
							var differVal = '';
							if(!Ext.isEmpty(jsonData.componentTypeOptions))
								differVal += jsonData.componentTypeOptions.selectedComponentType+'-';
							if(!Ext.isEmpty(jsonData.pageParams.selectedSubFilterOption))
								differVal += jsonData.pageParams.selectedSubFilterOption+'-';
							if(!Ext.isEmpty(jsonData.pageParams.selectedFilterByOption))
								differVal += jsonData.pageParams.selectedFilterByOption;
							
							compType= differVal;	
						}
					}
					catch (er)
					{
						compType= 'default';
					}
					if(jsonData.measures.length>0)
					{
						for(var j=0;j<jsonData.columns.length;j++)
						{
							ary=[];
							maxLength=0;
							for(var k=0;k<jsonData.measures.length;k++)
							{
								if((jsonData.measures[k][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									ary[aryIndex]=jsonData.measures[k][""+j+"MeasureValue"];
									aryIndex++;
								}
							}
							if(ary.length>0)
							{
								for(var i=0;i<ary.length;i++)
								{
									if( ary[i]!=null && ary[i]!="undefined")
									{
										if(ary[i].indexOf(".")!=-1){
											if(maxLength < (ary[i].substr(0,ary[i].indexOf("."))).length)
											{
												maxLength=(ary[i].substr(0,ary[i].indexOf("."))).length;
											}
										}
										else
										{
											if(maxLength < ary[i].length)
											{
												maxLength = ary[i].length;
											}
										}
									}
								}
							}
							for(var l=0;l<jsonData.measures.length;l++)
							{
								if((jsonData.measures[l][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									jsonData.measures[l][""+j+"MeasureValueLenWidth"]=maxLength*7;
								}
							}
							
						}
					}
				}
				myMask.hide();
				//if(!Ext.isEmpty(jsonData) && Ext.isEmpty(jsonData.error))
				if(!Ext.isEmpty(jsonData))
				{
					totalRecords=jsonData.countJson['recount'];
					totalPageNo=jsonData.countJson['totalPages'];
					pagesizec=jsonData.countJson['pagesizec'];
					this.entireData = jsonData;
					this.entireOrgData = jsonData;
					this.totalRecords = totalRecords;
					this.totalPageNo = totalPageNo;
					this.pagesize = pagesizec;
					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;
					startIn = (currentPage -1)*pagesizec;
					endIn = startIn + pagesizec;
					startIn = startIn+1;
					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;

					if(totalRecords <= 0)
						totalRecords = 1;

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();

					this.displayGrid(jsonData,totalRecords,totalPageNo,gridMsg,'',fromMetricView,dashboardName);
					if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
					{
						Ext.getCmp('afterTextColumn').setValue('1');
					}

					var val = 1;
					if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						val = pageNo;
					
					if(Ext.getCmp('afterTextColumn'))
					{
						Ext.getCmp('afterTextColumn').setValue(val);
						
						if(val == 1 || val == '1')
						{
							Ext.getCmp('firstRec').setDisabled(true);
							Ext.getCmp('prevRec').setDisabled(true);
							if(val == totalRecords){
								Ext.getCmp('nextRec').setDisabled(true);
								Ext.getCmp('lastRec').setDisabled(true);
							}
						}
						else if(val == totalRecords)
						{
							Ext.getCmp('nextRec').setDisabled(true);
							Ext.getCmp('lastRec').setDisabled(true);
						}
					}
				}
				else
				{
					myMask.hide();

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					me.removeAll();

					//display error message
					var error_msg=jsonData.error;
					var toolbarConfig=this.formToolbar(jsonData);

					var fromPageView=jsonData.pageParams.fromPageView;
					var hideComboandSearch=true;
					if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
						hideComboandSearch=false;

					var error_panel={
						xtype:'emptypanel',
						//tbar:toolbarConfig,
						style:{'border':'0px solid green !important'},
						border:false,
						margin:0,
						frame:false,
						flex:1,
						bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						cls:'datapanel',
						items: [{
								xtype: 'container',
								//padding: 50,
								style: {
									'text-align': 'center'
								},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
								}
						]
						//height : '100%'
					};
					var addContainer=null;
					if(hideComboandSearch)
					{
						addContainer=Ext.create('Ext.container.Container',{
							xtype:'container',
							//layout:'vbox',
							//layout:'fit',
							//html:'12121',
							flex:1,
							layout:{
								type:'vbox',
								align:'stretch'
							},
							items:[{
								xtype:'panel',
								layout:{type:'hbox',pack:'left'},
								padding:10,
								height:70,
								//height:90,
								cls:'formOuter',
								items:toolbarConfig
							},{
								xtype:'panel',
								cls:'dataPanel',
								autoScroll:false,
								scroll:false,
								//height:440,
								layout:'fit',
								flex:1,
								id:'gridContainer',
								items:[{
									xtype: 'container',
									//padding: 50,
									style: {
										'text-align': 'center'
									},
										html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
									}]
							}]
						});
					}
					else
					{
						addContainer=Ext.create('Ext.container.Container',{
							xtype:'container',
							//layout:'vbox',
							//layout:'fit',
							//html:'12121',
							flex:1,
							layout:{
								type:'vbox',
								align:'stretch'
							},
							items:[{
								xtype:'panel',
								cls:'dataPanel',
								autoScroll:false,
								scroll:false,
								//height:440,
								flex:1,
								layout:{
									type:'vbox',
									align:'stretch'
								},
								flex:1,
								id:'gridContainer',
								items:[{
									xtype: 'container',
									//padding: 50,
									style: {
										'text-align': 'center'
									},
										html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
									}]
							}]
						});
					}
					//this.addDocked({
							//xtype: 'toolbar',
							//dock: 'top',
							//cls:'formOuter',
							//padding:'4 10 8 2',
							//margin:'10 10 10 10',
							//bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
							//style:{'background-color':'transparent !important','background-image':'none !important'},
							//items: toolbarConfig
						//});
					//this.add(error_panel);
					this.add(addContainer);
					//Ext.getCmp("gridContainer").add(error_panel);
				}
				if(!Ext.isEmpty(me.disableCombo) && me.disableCombo){
					//Ext.getCmp('nickName').hide();
					Ext.getCmp('filterByCombo').disable();
					Ext.getCmp('subFilterCombo').disable();	
					if(!Ext.isEmpty(me.disableCompTypeCombo) && me.disableCompTypeCombo)
						Ext.getCmp('componentTypCombo').disable();						
				}
				try
				{
					if(!Ext.isEmpty(jsonData.externalTestObj.showSearchCombo) && !jsonData.externalTestObj.showSearchCombo)
					{
						Ext.getCmp('nickName').emptyText = ['Search by Script'];
						Ext.getCmp('nickName').applyEmptyText();
					}
				}
				catch (e)
				{
				}
				
			}});
		}
		else
		{
			// pass only one ajax req for data retrival alone
			Ext.Ajax.request({
				url : url,
				scope:this,
				timeout:280000,
				success: function(response)
				{
					myMask.hide();

					var jsonText = response.responseText;
					var jsonData = Ext.decode(jsonText);
					var ary=[],aryIndex=0,maxLength=0;
					if(!Ext.isEmpty(jsonData) && !Ext.isEmpty(jsonData.measures) && jsonData.measures!="undefiend")
					{
						try
						{
							if(dashboardNameT == 'SystemList')
							{
								var differVal = '';
								var differVal = '';
								if(!Ext.isEmpty(jsonData.componentTypeOptions))
									differVal += jsonData.componentTypeOptions.selectedComponentType+'-';
								if(!Ext.isEmpty(jsonData.pageParams.selectedSubFilterOption))
									differVal += jsonData.pageParams.selectedSubFilterOption+'-';
								if(!Ext.isEmpty(jsonData.pageParams.selectedFilterByOption))
									differVal += jsonData.pageParams.selectedFilterByOption;
								
								compType= differVal;
							}
							else if(dashboardNameT == 'comparisonDashboard')
							{
								if(jsonData.externalAgentObj.selectedextAgentType != undefined)
									compType=jsonData.externalAgentObj.selectedextAgentType;
								else if(len  > 2 )
									compType='all';
								else 
									compType='Not Applicable';
							}
							else
							{
								var differVal = '';
								if(!Ext.isEmpty(jsonData.componentTypeOptions))
									differVal += jsonData.componentTypeOptions.selectedComponentType+'-';
								if(!Ext.isEmpty(jsonData.pageParams.selectedSubFilterOption))
									differVal += jsonData.pageParams.selectedSubFilterOption+'-';
								if(!Ext.isEmpty(jsonData.pageParams.selectedFilterByOption))
									differVal += jsonData.pageParams.selectedFilterByOption;
								
								compType= differVal;
							}
							
						}
						catch (er)
						{
							compType= 'default';
						}
						if(jsonData.measures.length>0)
						{
							for(var j=0;j<jsonData.columns.length;j++)
							{
								maxLength=0;
								ary=[];
								for(var k=0;k<jsonData.measures.length;k++)
								{
									if((jsonData.measures[k][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="undefined")
									{
										ary[aryIndex]=jsonData.measures[k][""+j+"MeasureValue"];
										aryIndex++;
									}
								}
								if(ary.length>0)
								{
									for(var i=0;i<ary.length;i++)
									{
										if( ary[i]!=null && ary[i]!="undefined")
										{
											if(ary[i].indexOf(".")!=-1){
												if(maxLength < (ary[i].substr(0,ary[i].indexOf("."))).length)
												{
													maxLength=(ary[i].substr(0,ary[i].indexOf("."))).length;
												}
											}
											else
											{
												if(maxLength < ary[i].length)
												{
													maxLength = ary[i].length;
												}
											}
										}
									}
								}
								for(var l=0;l<jsonData.measures.length;l++)
								{
									if((jsonData.measures[l][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="undefined")
									{
										jsonData.measures[l][""+j+"MeasureValueLenWidth"]=maxLength*7;
									}
								}
							}
						}
					}
					totalRecords=jsonData.countJson['recount'];
					totalPageNo=jsonData.countJson['totalPages'];
					pagesizec=jsonData.countJson['pagesizec'];

					this.entireData = jsonData;
					this.entireOrgData = jsonData;
					this.totalRecords = totalRecords;
					this.totalPageNo = totalPageNo;
					this.pagesize = pagesizec;

					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;
					startIn = (currentPage -1)*pagesizec;
					endIn = startIn + pagesizec;
					startIn = startIn+1;
					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;
					if(totalRecords <= 0)
						totalRecords = 1;
					if(!Ext.isEmpty(jsonData.aggregateTab))										// Prem
					{
						if(!Ext.isEmpty(me.up('segmentsdashboard')))
							me.up('segmentsdashboard').aggregateTab = jsonData.aggregateTab;
						if(!Ext.isEmpty(me.up('servicesdashboard')))
							me.up('servicesdashboard').aggregateTab = jsonData.aggregateTab;
						if(!Ext.isEmpty(me.up('zonesdashboard')))
							me.up('zonesdashboard').aggregateTab = jsonData.aggregateTab;
					}																			// Prem

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();
					
					
					//if(!Ext.isEmpty(jsonData) && Ext.isEmpty(jsonData.error))
					if(!Ext.isEmpty(jsonData))
					{
						this.displayGrid(jsonData,totalRecords,totalPageNo,gridMsg,pageNo,fromMetricView,dashboardName);
						if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
						{
							Ext.getCmp('afterTextColumn').setValue('1');
						}

						//Ext.getCmp('afterTextColumn').setValue('1');
					}
					else
					{
						var dockedItems = me.getDockedItems('toolbar');
						for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
							me.removeDocked(dockedItems[dockedCounter]);
						}

						me.removeAll();

						//display error message
						var error_msg=jsonData.error;
						var toolbarConfig=this.formToolbar(jsonData);
						var error_panel={
								xtype:'emptypanel',
								//tbar:toolbarConfig,
								style:{'border':'0px solid green !important'},
								border:false,
								margin:0,
								frame:false,
								flex:1,
								bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
								cls:'datapanel',
								items: [{
										xtype: 'container',
										//padding: 50,
										style: {
											'text-align': 'center'
										},
										html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
										}
								]
								//height : '100%'
						};
						
						var fromPageView=jsonData.pageParams.fromPageView;
						var hideComboandSearch=true;
						if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
							hideComboandSearch=false;
						if(hideComboandSearch)
						{
							this.addDocked({
									xtype: 'toolbar',
									dock: 'top',
									id:'toolBar_config',
									cls:'linebottom toolbarBg',
									padding:'1 10 1 2',
									//bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
									//style:{'background-color':'transparent !important','background-image':'none !important'},
									items: toolbarConfig
								});
						}
						this.add(error_panel);
					}

					var val = 1;
					if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						val = pageNo;

					if(Ext.getCmp('afterTextColumn'))
					{
						Ext.getCmp('afterTextColumn').setValue(val);
						
						if(val == 1 || val == '1'){
							Ext.getCmp('firstRec').setDisabled(true);
							Ext.getCmp('prevRec').setDisabled(true);
							if(val == totalRecords){
								Ext.getCmp('nextRec').setDisabled(true);
								Ext.getCmp('lastRec').setDisabled(true);
							}
						}else if(val == totalRecords){
							Ext.getCmp('nextRec').setDisabled(true);
							Ext.getCmp('lastRec').setDisabled(true);
						}
					}
					if(!Ext.isEmpty(me.disableCombo) && me.disableCombo){
						//Ext.getCmp('nickName').hide();
						Ext.getCmp('filterByCombo').disable();
						Ext.getCmp('subFilterCombo').disable();						
						Ext.getCmp('componentTypCombo').disable();						
					}
					
					try
					{
						if(!Ext.isEmpty(jsonData.externalTestObj.showSearchCombo) && !jsonData.externalTestObj.showSearchCombo)
						{
							Ext.getCmp('nickName').emptyText = ['Search by Script'];
							Ext.getCmp('nickName').applyEmptyText();
						}	
					}
					catch (e)
					{
					}					
				}
			});
		}
	},
	loadTabJson:function(jsonData,url,fromMetricView,dashboardName,filterComp){
		if(dashboardName != undefined && dashboardName != null)
			dashboardNameT = dashboardName;
		else
			dashboardNameT = 'otherDashboard';

		try
		{
			compType= filterComp;			
		}
		catch (er)
		{
			compType= 'default';
		}
		glUrl=url;
		
		var me = this;
		var myMask = null;
		/*if(!Ext.isEmpty(me))
		{
			myMask = new Ext.LoadMask(me, {msg:"Please wait..."});
			myMask.show();
		}*/

		if(!Ext.isEmpty(jsonData))
		{
			totalRecords=jsonData.countJson['recount'];
			totalPageNo=jsonData.countJson['totalPages'];
			pagesizec=jsonData.countJson['pagesizec'];
			var ary=[],aryIndex=0,maxLength=0;
			if(!Ext.isEmpty(jsonData) && !Ext.isEmpty(jsonData.measures) && jsonData.measures!="undefiend")
			{
				if(jsonData.measures.length>0)
				{
					for(var j=0;j<jsonData.columns.length;j++)
					{
						ary=[];
						maxLength=0;
						for(var k=0;k<jsonData.measures.length;k++)
						{
							if((jsonData.measures[k][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="undefined")
							{
								ary[aryIndex]=jsonData.measures[k][""+j+"MeasureValue"];
								aryIndex++;
							}
						}
						if(ary.length>0)
						{
							for(var i=0;i<ary.length;i++)
							{
								if( ary[i]!=null && ary[i]!="undefined")
								{
									if(ary[i].indexOf(".")!=-1){
										if(maxLength < (ary[i].substr(0,ary[i].indexOf("."))).length)
										{
											maxLength=(ary[i].substr(0,ary[i].indexOf("."))).length;
										}
									}
									else
									{
										if(maxLength < ary[i].length)
										{
											maxLength = ary[i].length;
										}
									}
								}
							}
						}
						
						for(var l=0;l<jsonData.measures.length;l++)
						{
							if((jsonData.measures[l][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="undefined")
							{
								jsonData.measures[l][""+j+"MeasureValueLenWidth"]=maxLength*7;
							}
						}
					}
				}
			}
			this.entireData = jsonData;
			this.entireOrgData = jsonData;
			this.totalRecords = totalRecords;
			this.totalPageNo = totalPageNo;
			this.pagesize = pagesizec;
			var currentPage = 1;
			
			if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
				currentPage=pageNo;
			startIn = (currentPage -1)*pagesizec;
			endIn = startIn + pagesizec;
			startIn = startIn+1;
			if(endIn > totalRecords )
				endIn = totalRecords;
			
			gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;

			if(totalRecords <= 0)
				totalRecords = 1;

			var dockedItems = me.getDockedItems('toolbar');
			for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
				me.removeDocked(dockedItems[dockedCounter]);
			}

			if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
				me.removeAll();

			this.displayGrid(jsonData,totalRecords,totalPageNo,gridMsg,'',fromMetricView,dashboardName);
			if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
			{
				Ext.getCmp('afterTextColumn').setValue('1');
			}

			var val = 1;
			if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
				val = pageNo;
			
			if(Ext.getCmp('afterTextColumn'))
			{
				Ext.getCmp('afterTextColumn').setValue(val);
				
				if(val == 1 || val == '1')
				{
					Ext.getCmp('firstRec').setDisabled(true);
					Ext.getCmp('prevRec').setDisabled(true);
					if(val == totalRecords){
						Ext.getCmp('nextRec').setDisabled(true);
						Ext.getCmp('lastRec').setDisabled(true);
					}
				}
				else if(val == totalRecords)
				{
					Ext.getCmp('nextRec').setDisabled(true);
					Ext.getCmp('lastRec').setDisabled(true);
				}
			}
		}
		else
		{
			myMask.hide();

			var dockedItems = me.getDockedItems('toolbar');
			for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
				me.removeDocked(dockedItems[dockedCounter]);
			}

			me.removeAll();

			//display error message
			var error_msg=jsonData.error;
			var toolbarConfig=this.formToolbar(jsonData);

			var fromPageView=jsonData.pageParams.fromPageView;
			var hideComboandSearch=true;
			if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
				hideComboandSearch=false;

			var error_panel={
				xtype:'emptypanel',
				//tbar:toolbarConfig,
				style:{'border':'0px solid green !important'},
				border:false,
				margin:0,
				frame:false,
				flex:1,
				bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
				cls:'datapanel',
				items: [{
						xtype: 'container',
						//padding: 50,
						style: {
							'text-align': 'center'
						},
						html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
						}
				]
				//height : '100%'
			};
			var addContainer=null;
			if(hideComboandSearch)
			{
				addContainer=Ext.create('Ext.container.Container',{
					xtype:'container',
					//layout:'vbox',
					//layout:'fit',
					//html:'12121',
					flex:1,
					layout:{
						type:'vbox',
						align:'stretch'
					},
					items:[{
						xtype:'panel',
						layout:{type:'hbox',pack:'left'},
						padding:10,
						height:70,
						//height:90,
						cls:'formOuter',
						items:toolbarConfig
					},{
						xtype:'panel',
						cls:'dataPanel',
						autoScroll:false,
						scroll:false,
						//height:440,
						layout:'fit',
						flex:1,
						id:'gridContainer',
						items:[{
							xtype: 'container',
							//padding: 50,
							style: {
								'text-align': 'center'
							},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
							}]
					}]
				});
			}
			else
			{
				addContainer=Ext.create('Ext.container.Container',{
					xtype:'container',
					//layout:'vbox',
					//layout:'fit',
					//html:'12121',
					flex:1,
					layout:{
						type:'vbox',
						align:'stretch'
					},
					items:[{
						xtype:'panel',
						cls:'dataPanel',
						autoScroll:false,
						scroll:false,
						//height:440,
						flex:1,
						layout:{
							type:'vbox',
							align:'stretch'
						},
						flex:1,
						id:'gridContainer',
						items:[{
							xtype: 'container',
							//padding: 50,
							style: {
								'text-align': 'center'
							},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
							}]
					}]
				});
			}
			//this.addDocked({
					//xtype: 'toolbar',
					//dock: 'top',
					//cls:'formOuter',
					//padding:'4 10 8 2',
					//margin:'10 10 10 10',
					//bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
					//style:{'background-color':'transparent !important','background-image':'none !important'},
					//items: toolbarConfig
				//});
			//this.add(error_panel);
			this.add(addContainer);
			//Ext.getCmp("gridContainer").add(error_panel);
		}
	},
	formToolbar:function(jsonData){
		//create combo if selectfieldData present in data
		var filterByCombo=null;

		var filterByComboStore = Ext.create('Ext.data.Store',{
			fields:['displayField','valueField'],
			proxy:{
				type: 'memory',
				reader: {
					type: 'json',
					//root:'SortbytypeKey'
				}
			},
			data:jsonData.filterByOptions
		});
		filterByCombo={
			xtype:'combo',
			id:'filterByCombo',
			labelAlign : 'top',
			editable : false,
			store:filterByComboStore,
			labelSeparator:'',
			cls : 'dropdown',
			displayField: 'displayField',
			valueField: 'valueField',
			trigerAction:'all',
			fieldLabel:'Filter by',
			labelWidth:60,
			queryMode: 'local',
			margin:1,
			//value:'filterByCombo'
			//value:jsonData.sortByMainOptions.SortbytypeKey.name
			value:jsonData.pageParams.selectedFilterByOption
		};

		var subFilterCombo=null;
		var subFilterComboStroe = Ext.create('Ext.data.Store',{
			fields:['displayField','valueField'],
			proxy:{
				type: 'memory',
				reader: {
					type: 'json',
					//root:'SortbytypeKey'
				}
			},
			data:jsonData.subFilterOptions
		});
		subFilterCombo={
			xtype:'combo',
			id:'subFilterCombo',
			labelAlign : 'top',
			editable : false,
			store:subFilterComboStroe,
			labelSeparator:'',
			cls : 'dropdown',
			displayField: 'displayField',
			valueField: 'valueField',
			trigerAction:'all',
			fieldLabel:jsonData.pageParams.subFilterLabel,
			labelWidth:60,
			margin:'0 0 0 60',
			queryMode:'local',
			hidden: jsonData.pageParams.isSubFilterOption,
			//value:'subFilterCombo'
			//value:jsonData.sortByMainOptions.SortbytypeKey.name
			value:jsonData.pageParams.selectedSubFilterOption
		};

		var componentTypCombo=null;
		if(!Ext.isEmpty(jsonData.componentTypeOptions))
		{
			var componentTypStore = Ext.create('Ext.data.Store',{
				fields:['value','name'],
				proxy:{
					type: 'memory',
					reader: {
						type: 'json',
						root:'selectOptions'
					}
				},
				data:jsonData.componentTypeOptions
			});
			componentTypCombo={
				xtype:'combo',
				id:'componentTypCombo',
				labelAlign : 'top',
				editable : false,
				store:componentTypStore,
				labelSeparator:'',
				cls : 'dropdown',
				margin:'0 0 0 60',
				displayField:'name',
				valueField:'value',
				trigerAction:'all',
				queryMode: 'local',
				fieldLabel:jsonData.componentTypeOptions.componentTypeLabel,
				labelWidth:120,
				value:jsonData.componentTypeOptions.selectedComponentType
			};
		}
		
		var sortByCombo=null;
		if(!Ext.isEmpty(jsonData.sortByMainOptions))
		{
			var sortByComboStore = Ext.create('Ext.data.Store',{
				fields:['value','name'],
				proxy:{
					type: 'memory',
					reader: {
						type: 'json',
						//root:'SortbytypeKey'
					}
				},
				data:jsonData.sortByMainOptions.sortByOptions
			});
			sortByCombo={
				xtype:'combo',
				id:'sortByCombo',
				labelAlign : 'top',
				editable : false,
				hidden: true,
				margin:'0 0 0 60',
				store:sortByComboStore,
				labelSeparator:'',
				cls : 'dropdown',
				displayField:'name',
				valueField:'value',
				trigerAction:'all',
				queryMode: 'local',
				fieldLabel:jsonData.sortByMainOptions.sortByLabel,
				labelWidth:60,
				value:jsonData.sortByMainOptions.sortBySelectedMeasure
				//value:jsonData.sortByMainOptions.SortbytypeKey.name
				//value:'Please Select Options'
			};
		}
		//var nickName=null;
		/*nickName={
			xtype: 'textfield',
			//labelAlign:'top',
			//columnWidth:'.17',
			minWidth:50,
			//maxWidth:300,
			id:'nickName',
			cls :'textbox',
			placeholderText:'Component Name',
			//fieldLabel:'Nick Name',
			//fieldCls:'top-left-radius top-right-radius bottom-left-radius bottom-right-radius',
			//padding:10,
			//fieldLabel: jsonData.SearchLabels["searchNameLabel"] ? jsonData.SearchLabels["searchNameLabel"] : "",
			value: jsonData.pageParams.searchnickname,
			action:'nickname'
		}*/
		/*{
			xtype:'trigger',
			style:{'float':'right'},
			fieldLabel:'',
			cls: 'whitedropdown_search',
			emptyText:'Component Name',
			id : 'nickName',
			name : 'nickName',
			labelSeparator:'',
			labelAlign : 'top',
			fieldLabel:'&nbsp;',
			margin:'10 15 0 0',
			name : 'searchTextBox',
			enableKeyEvents: true,
			value: jsonData.pageParams.searchnickname,
			onTriggerClick: function() {
				Ext.getCmp('perPanel').compSubmitButtonClicked();
			}
		}*/
		var submitbut=null;
		submitbut={
			xtype:'button',
			//cls : 'button20 submit-button',
			id:'submitbut',
			cls : 'button20',
			margin:'31 0 0 20',
			//padding:10,
			minWidth:80,
			maxWidth:120,
			hidden:true,
			//text:jsonData.SearchLabels["submitBtnText"] ? jsonData.SearchLabels["submitBtnText"] : "",
			fieldLabel:'Submit',
			action:'submit',
			value:'Submit'
		}
		var systemGridTitle=jsonData.screenLabels[this.screenLabelPath+'.systemTitle'];
		var toolbarConfig=new Array();
		toolbarConfig.push({
			xtype:'label',
			text:systemGridTitle,
			cls:'toolbar-title',
			margin:3,
			disableSelection : true
		});

		if(this.itemId=='logonSimualtion'){
			var labelFields=null;
			labelFields={
				xtype : 'label',
				text : 'Citrix Logon Simualtors',
				cls:'toolbar-title',
				width:'auto',
				margin:'10 10 10 10',
				align:'left'
			}
			//toolbarConfig.push(labelFields);
			/*if(monitorsCombo != null && monitorsCombo != undefined){
				monitorsCombo.hidden = true;
				monitorsCombo.value = 'ExternalMonitor';
			}*/
			/*var agentSelectredVal;
			var len = 0;
			try
			{
				len= jsonData.externalAgentObj.externalAgentArr.length;
			}
			catch (e)
			{
			}
				
			if(jsonData.externalAgentObj.selectedextAgentType != undefined)
				agentSelectredVal=jsonData.externalAgentObj.selectedextAgentType;
			else if(len  > 2 )
				agentSelectredVal='all';
			else 
				agentSelectredVal='Not Applicable';

			var extAgentStore = Ext.create('Ext.data.Store',{
				fields:['name','value'],
				proxy:{
					type: 'memory',
					reader: {
						type: 'json',
						root:'externalAgentArr'
					}
				},
				data:jsonData.externalAgentObj
			});
			extAgent={
				xtype:'combo',
				id:'extAgent',
				labelAlign : 'top',
				editable : false,
				store:extAgentStore,
				labelSeparator:'',
				cls : 'dropdown',
				displayField: 'name',
				valueField: 'value',
				trigerAction:'all',
				fieldLabel:'External Agents',
				labelWidth:60,
				queryMode: 'local',
				margin:1,
				//value:'filterByCombo'
				//value:'Chennai'
				value:agentSelectredVal
			};
			
			toolbarConfig.push(extAgent);*/
			
		}else{
			toolbarConfig.push(filterByCombo);
			toolbarConfig.push(subFilterCombo);
		
			toolbarConfig.push(componentTypCombo);
			toolbarConfig.push(sortByCombo);
			//toolbarConfig.push(monitorsCombo);
			//toolbarConfig.push(locationCombo);
			//toolbarConfig.push(submitbut);
		}
		
		return toolbarConfig;
	},
	compSubmitButtonClicked:function(fromPageView,userName,selectedStateVal,fromMetricView)
	{
		var filterByComboVal="";
		if(Ext.getCmp('filterByCombo')!=null && Ext.getCmp('filterByCombo')!=undefined)
		{
			filterByComboVal = Ext.getCmp('filterByCombo').getValue();
		}

		var subFilterComboVal="";
		if(Ext.getCmp('subFilterCombo')!=null && Ext.getCmp('subFilterCombo')!=undefined && Ext.getCmp('subFilterCombo').getValue()!=null && Ext.getCmp('subFilterCombo').getValue()!='null')
		{
			subFilterComboVal = Ext.getCmp('subFilterCombo').getValue();
		}

		var componentTypeVal="";
		if(Ext.getCmp('componentTypCombo')!=null && Ext.getCmp('componentTypCombo')!=undefined && Ext.getCmp('componentTypCombo').getValue()!=null && Ext.getCmp('componentTypCombo').getValue()!='null')
		{
			componentTypeVal = Ext.getCmp('componentTypCombo').getValue();
		}
		var nickNameVal="";
		if(Ext.getCmp('nickName')!=null && Ext.getCmp('nickName')!=undefined && Ext.getCmp('nickName').getValue()!=null && Ext.getCmp('nickName').getValue()!='null')
		{
			nickNameVal = Ext.getCmp('nickName').getValue();
		}
		var sortByComboVal="";
		if(Ext.getCmp('sortByCombo')!=null && Ext.getCmp('sortByCombo')!=undefined && Ext.getCmp('sortByCombo').getValue()!=null && Ext.getCmp('sortByCombo').getValue()!='null')
		{
			sortByComboVal = Ext.getCmp('sortByCombo').getValue();
		}
		var url="";
		var itemIdVal=this.itemId;

		if(itemIdVal=='system' || itemIdVal=='System')
		{
			url="/final/monitor/comparisonSystem.jsp?treeTitle=System";
			url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&viewPageTitle="+encodeURIComponent(requestParams.viewPageTitle);
		}
		else if(itemIdVal=='components' || itemIdVal=='Components')
		{
			url="/final/monitor/comparisonComponent.jsp?treeTitle=Component";
			url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&fromPageView="+fromPageView+"&userName="+encodeURIComponent(userName)+"&selectedState="+selectedStateVal+"&viewPageTitle="+encodeURIComponent(requestParams.viewPageTitle);
		}
		else if(itemIdVal=='network' || itemIdVal=='Network')
		{
			url="/final/monitor/comparisonComponent.jsp?treeTitle=Network";
			url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&fromPageView="+fromPageView+"&userName="+encodeURIComponent(userName)+"&selectedState="+selectedStateVal+"&viewPageTitle="+encodeURIComponent(requestParams.viewPageTitle);
		}
		/*else if(itemIdVal=='logonSimualtion' || itemIdVal=='logonSimualtion')
		{
			var extAgentVal="";
			if(Ext.getCmp('extAgent')!=null && Ext.getCmp('extAgent')!=undefined && Ext.getCmp('extAgent').getValue()!=null && Ext.getCmp('extAgent').getValue()!='null')
			{
				extAgentVal = Ext.getCmp('extAgent').getValue();
			}

			url="/final/monitor/comparisonLogonSimulator.jsp?ltype=citrix&treeTitle=logonSimualtion&monitorsBy=LogonSimulator";
			url=url+"&filterBy="+filterByComboVal+"&externalAgent="+extAgentVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&isFromInfraHome="+isFromInfraHome;
			//Refurl=url;
			//this.getCommonPanel().loadTab(url);
			//return ;
		}
		else if(itemIdVal=='horizonlogonSimualtion' )
		{
			var extAgentVal="";
			if(Ext.getCmp('extAgent')!=null && Ext.getCmp('extAgent')!=undefined && Ext.getCmp('extAgent').getValue()!=null && Ext.getCmp('extAgent').getValue()!='null')
			{
				extAgentVal = Ext.getCmp('extAgent').getValue();
			}

			url="/final/monitor/comparisonLogonSimulator.jsp?ltype=horizon&treeTitle=horizonlogonSimualtion&monitorsBy=hrznLogonSimulator";
			url=url+"&filterBy="+filterByComboVal+"&externalAgent="+extAgentVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&isFromInfraHome="+isFromInfraHome;
		}*/
		else
		{
			var extAgentVal="";
			if(Ext.getCmp('extAgent')!=null && Ext.getCmp('extAgent')!=undefined && Ext.getCmp('extAgent').getValue()!=null && Ext.getCmp('extAgent').getValue()!='null')
			{
				extAgentVal = Ext.getCmp('extAgent').getValue();
			}

			url="/final/monitor/comparisonLogonSimulator.jsp?ltype="+ltype+"&ltest="+ltest+"&treeTitle="+treeTitle+"&monitorsBy="+monitorsBy;
			url=url+"&filterBy="+filterByComboVal+"&externalAgent="+extAgentVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&isFromInfraHome="+isFromInfraHome;
		}

		var url = url;
		Refurl=url;
		Ext.getCmp('perPanel').loadTab(url,'','','',fromMetricView);
	},

	sortByGridColumn:function(measureOrgName,measureSortType,fromPageView,selectedStateVal,userName){
		
		var filterByComboVal="";
		if(Ext.getCmp('filterByCombo')!=null && Ext.getCmp('filterByCombo')!=undefined && Ext.getCmp('filterByCombo').getValue()!=null && Ext.getCmp('filterByCombo').getValue()!='null')
		{
			filterByComboVal = Ext.getCmp('filterByCombo').getValue();
		}

		var subFilterComboVal="";
		if(Ext.getCmp('subFilterCombo')!=null && Ext.getCmp('subFilterCombo')!=undefined && Ext.getCmp('subFilterCombo').getValue()!=null && Ext.getCmp('subFilterCombo').getValue()!='null')
		{
			subFilterComboVal = Ext.getCmp('subFilterCombo').getValue();
		}

		var componentTypeVal="";
		if(Ext.getCmp('componentTypCombo')!=null && Ext.getCmp('componentTypCombo')!=undefined && Ext.getCmp('componentTypCombo').getValue()!=null && Ext.getCmp('componentTypCombo').getValue()!='null')
		{
			componentTypeVal = Ext.getCmp('componentTypCombo').getValue();
		}
		var nickNameVal="";
		if(Ext.getCmp('nickName')!=null && Ext.getCmp('nickName')!=undefined && Ext.getCmp('nickName').getValue()!=null && Ext.getCmp('nickName').getValue()!='null')
		{
			nickNameVal = Ext.getCmp('nickName').getValue();
		}
		var url="";
		var itemIdVal=this.itemId;
		if(itemIdVal=='system' || itemIdVal=='System')
		{
			url="/final/monitor/comparisonSystem.jsp?treeTitle=System";
			if(measureOrgName!=null && measureOrgName=='-1')
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&componentType="+encodeURIComponent(componentTypeVal);
			}
			else
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&column="+measureOrgName+"&sortOrder="+measureSortType+"&componentType="+encodeURIComponent(componentTypeVal);
			}

		}
		else if(itemIdVal=='components' || itemIdVal=='Components')
		{
			url="/final/monitor/comparisonComponent.jsp?treeTitle=Component";
			if(measureOrgName!=null && measureOrgName=='-1')
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&fromPageView="+fromPageView+"&selectedState="+selectedStateVal+"&userName="+encodeURIComponent(userName);
				
			}
			else
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&appcolumn="+measureOrgName+"&appsortOrder="+measureSortType+"&fromPageView="+fromPageView+"&selectedState="+selectedStateVal+"&userName="+encodeURIComponent(userName);
			}
		}
		else if(itemIdVal=='network' || itemIdVal=='Network')
		{
			url="/final/monitor/comparisonComponent.jsp?treeTitle=Network";
			if(measureOrgName!=null && measureOrgName=='-1')
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&fromPageView="+fromPageView+"&selectedState="+selectedStateVal+"&userName="+encodeURIComponent(userName);
				
			}
			else
			{
				url=url+"&filterBy="+filterByComboVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentType="+encodeURIComponent(componentTypeVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&appcolumn="+measureOrgName+"&appsortOrder="+measureSortType+"&fromPageView="+fromPageView+"&selectedState="+selectedStateVal+"&userName="+encodeURIComponent(userName);
			}
		}
		/*else if(itemIdVal=='logonSimualtion'){

			var monitorsComboVal="LogonSimulator";
			if(Ext.getCmp('monitorsCombo')!=null && Ext.getCmp('monitorsCombo')!=undefined && Ext.getCmp('monitorsCombo').getValue()!=null && Ext.getCmp('monitorsCombo').getValue()!='null')
			{
				monitorsComboVal = Ext.getCmp('monitorsCombo').getValue();
			}

			//url='/final/monitor/comparisonDashboard.jsp?treeTitle=externalMonitor&isFromMenu=true';
			url='/final/monitor/comparisonLogonSimulator.jsp?treeTitle=logonSimualtion&monitorsBy='+monitorsComboVal+'&componentType=&selectedState=&filterBy=&subFilter=&componentNameSearch=&isFromInfraHome='+isFromInfraHome;
		}
		else if(itemIdVal=='horizonlogonSimualtion'){

			var monitorsComboVal="hrznLogonSimulator";
			url='/final/monitor/comparisonLogonSimulator.jsp?treeTitle=horizonlogonSimualtion&monitorsBy='+monitorsComboVal+'&componentType=&selectedState=&filterBy=&subFilter=&componentNameSearch=&isFromInfraHome='+isFromInfraHome;
		}*/
		else
		{
			var extAgentVal="";
			if(Ext.getCmp('extAgent')!=null && Ext.getCmp('extAgent')!=undefined && Ext.getCmp('extAgent').getValue()!=null && Ext.getCmp('extAgent').getValue()!='null')
			{
				extAgentVal = Ext.getCmp('extAgent').getValue();
			}

			var extTestVal = ltest;
			var sortParam = '';
			if(itemIdVal=='ExtTestDashboard'){
				ltype = '';
				if(Ext.getCmp('extTest')!=null && Ext.getCmp('extTest')!=undefined && Ext.getCmp('extTest').getValue()!=null && Ext.getCmp('extTest').getValue()!='null')
				{
					extTestVal = Ext.getCmp('extTest').getValue();
				}

				if(extParamList != null && extParamList.length > 0){
					var index = extParamList.indexOf(extTestVal);
					if(index >= 0)
						monitorsBy = extParamList[index-1];
					else
						monitorsBy = null;
				}
				sortParam = "&sortOrder="+measureSortType+"&sortBy="+measureOrgName;
			}

			url="/final/monitor/comparisonLogonSimulator.jsp?ltype="+ltype+"&ltest="+extTestVal+"&treeTitle="+treeTitle+"&monitorsBy="+monitorsBy;
			url=url+"&filterBy="+filterByComboVal+"&externalAgent="+extAgentVal+"&subFilter="+encodeURIComponent(subFilterComboVal)+"&componentNameSearch="+encodeURIComponent(nickNameVal)+"&isFromInfraHome="+isFromInfraHome;

			if(isFromMenu != undefined && isFromMenu != null && isFromMenu != 'null' && isFromMenu != '' && (isFromMenu== true || isFromMenu=='true' ))
				url+="&isFromMenu="+isFromMenu;
			if(isFromZoneInfra != undefined && isFromZoneInfra != null && isFromZoneInfra != 'null' && isFromZoneInfra != '' && (isFromZoneInfra== true || isFromZoneInfra=='true' ))
			{	
				url+="&isFromZoneInfra="+isFromZoneInfra;
				if(zoneName != undefined && zoneName != null && zoneName != 'null' && zoneName != '' )
					url+="&zoneName="+zoneName;
			}
			try
			{
				url += "&isLogonType="+isLogonType;
			}
			catch (e)
			{
			}

			if(!Ext.isEmpty(sortParam) && sortParam != null)
				url += sortParam;
		}
		Refurl=url;
		Ext.getCmp('perPanel').loadTab(url);

		/*Ext.Ajax.request({
			url :url,
			scope:this,
			timeout:280000,
			success: function(response){
				var jsonText = response.responseText;
				var jsonData = Ext.decode(jsonText);
				var gridPanel = this.down('generalMeasuresGrid');
				gridPanel.getStore().loadRawData(jsonData);
			}
		});*/
	},
	returnPaginationData:function(pageNo,fromMetricView,dashboardName){
		try
		{
			var page_no= 1;
			if(Ext.isEmpty(pageNo))
				pageNo="1";
			page_no = parseInt(pageNo);

			if(page_no < 1)
				page_no="1";
			var compressData = [];
			var startIndex = 0;
			//var cloneJsonData = Object.assign({}, this.entireData);
			var cloneJsonData = jQuery.extend(true, {}, this.entireData);
			var gridMsg='';
			try
			{

				if(this.entireData != undefined && this.entireData != null && this.entireData.measures != undefined && this.entireData.measures != null && this.entireData.measures.length == this.totalRecords){
					if(page_no == 1)
						startIndex = 0;
					else
						startIndex = (page_no*this.pagesize)-this.pagesize;
					
					var el=0;
					for(i in this.entireData.measures){
						if(i>=startIndex){
							compressData[el]=this.entireData.measures[i];
							el++;
							if(el == this.pagesize)
							{
								break;
							}
						}else
							continue;
					}
					if(compressData != undefined && compressData.length > 0)
						cloneJsonData.measures=compressData;
					var startIn = (page_no -1)*this.pagesize;
					var endIn = startIn + this.pagesize;
					startIn = startIn+1;
					if(endIn > this.totalRecords )
						endIn = this.totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+this.totalRecords;
				}
			}
			catch (e)
			{
				//console.log('----ee--->',e)
			}
		}
		catch (e)
		{
			//console.log('----eeeeee--->',e)
		}
	
		if(!Ext.isEmpty(Ext.getCmp('gridContainer')))
			this.removeAll();
		
		
		this.displayGridData(cloneJsonData,this.totalRecords,this.totalPageNo,gridMsg,fromMetricView,dashboardName);
		if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
			Ext.getCmp('afterTextColumn').setValue(page_no);
	},
	sortByGridData:function(dataIndex_temp,pageNo,fromMetricView,dashboardName){
		var dataIndex = dataIndex_temp;
		var org_dataIndex = dataIndex;
		
		var cloneJsonData = jQuery.extend(true, {}, this.entireData);
		try
		{
			if(cloneJsonData != undefined && cloneJsonData != null && cloneJsonData.measures != undefined && cloneJsonData.measures != null && cloneJsonData.measures.length == this.totalRecords && dataIndex != undefined){
				
				RefSortByLogon = dataIndex;
				if(fromServiceDashboard != null  && (fromServiceDashboard == 'true' || fromServiceDashboard == true) && !Ext.isEmpty(parent))
				{
					parent.Ext.getCmp('logonSimCompId').service_RefSortByLogon = dataIndex;
				}
				RefSortByLogonType = this.sort;

				if(fromServiceDashboard != null  && (fromServiceDashboard == 'true' || fromServiceDashboard == true) && !Ext.isEmpty(parent))
				{
					parent.Ext.getCmp('logonSimCompId').service_RefSortByLogonType = this.sort;
				}

				var datas = cloneJsonData.measures;
				var sorted_datas=[];
				var dataMap = new Ext.util.HashMap();
				dataIndex = dataIndex+"_org";
				var isNumber = false;
				var isString = false;
				for(i in datas){
					var obj = datas[i];
					var value="-";
					try
					{
						value = obj[dataIndex];
						if(value == undefined)
						{
							dataIndex = org_dataIndex;
							value = obj[dataIndex];
						}
						
						if (typeof value == "string")
						{
							value = value.toLowerCase();
							isString = true;
						}
						else if (typeof value == "number"){
							isNumber = true;
						}
						
					}
					catch (e)
					{
						value="-";
					}
					
					var check = dataMap.get(value);
					if(check == undefined || check == null){
						var valArr = [];
						valArr.push(i);
						dataMap.add(value,valArr);
					}else{
						check.push(i);
						dataMap.add(value,check);
					}
				}
				
				if(dataMap.length == 0)
					return;
				var dataKeyArr = dataMap.getKeys();

				if(isNumber)
					dataKeyArr.sort(function(a,b){return a-b;});
				else
					dataKeyArr.sort();

				if(this.sort == 'desc')
				{
					dataKeyArr.reverse();
					this.sort="asc";
				}else
					this.sort="desc";

				var el=0;
				for(i in dataKeyArr){
					var key = dataKeyArr[i];
					var valArr = dataMap.get(key);
					for(p in valArr)
					{
						sorted_datas[el]=datas[valArr[p]];
						el++;
					}
				}

				cloneJsonData.measures = sorted_datas;
				
				this.entireData = cloneJsonData;

				if(Ext.isEmpty(pageNo))
					this.returnPaginationData("1",fromMetricView,dashboardName);
				else
					this.returnPaginationData(pageNo,fromMetricView,dashboardName);
			}
		}
		catch (e)
		{
		}
	},
	sortIconDispOperation:function(id){
		try
		{
			if(sortIconIdArr != undefined && sortIconIdArr != null && sortIconIdArr.length > 0){
				for(i in sortIconIdArr){
					var el = sortIconIdArr[i];
					var asc_el = document.getElementById(el+''+typeAr[0]);
					var desc_el = document.getElementById(el+''+typeAr[1]);
					if(asc_el != undefined)
						asc_el.style.display='none';
					if(desc_el != undefined)
						desc_el.style.display='none';
				}

				if(id != undefined && id != null ){
					var visible_id=id;
					RefSortByLogonId = id;
					if(fromServiceDashboard != null  && (fromServiceDashboard == 'true' || fromServiceDashboard == true) && !Ext.isEmpty(parent))
					{
						parent.Ext.getCmp('logonSimCompId').service_RefSortByLogonId = id
					}
					if(this.sort=='asc')
						visible_id+='desc';
					if(this.sort=='desc')
						visible_id+='asc';
					document.getElementById(visible_id).style.display='block';
				}
			}
		}
		catch (e)
		{
			//console.log('e-->',e)
		}
		
	},
	displayGrid:function(jsonData_org,totalRecords,totalPageNo,gridMsg,pageNo,fromMetricView,dashboardName){
		//if(this.itemId=='logonSimualtion' || this.itemId=='horizonlogonSimualtion')

		try
		{
			if(!Ext.isEmpty(simulationSupportListHere))
			{
				for(var a in simulationSupportListHere)
					simulationSupportList.push(simulationSupportListHere[a]);
			}
		}
		catch (e)
		{
			
		}
		
		if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
		{
			if(Ext.isEmpty(RefSortByLogon))
				this.returnPaginationData(pageNo,fromMetricView,dashboardName);
			else
			{
				this.sort = RefSortByLogonType;
				this.sortByGridData(RefSortByLogon,pageNo,fromMetricView,dashboardName);
			}
		}else{
			this.displayGridData(jsonData_org,totalRecords,totalPageNo,gridMsg,fromMetricView,dashboardName);
		}
		
	},
	displayGridData:function(jsonData_org,totalRecords,totalPageNo,gridMsg,fromMetricView,dashboardName){
		var jsonData = jsonData_org;
		try
		{
			if(jsonData != null && jsonData.hasOwnProperty("sortinJs"))
			{
				var getDataIndex = "";
				var getDataIndexSortType = "";
				if(jsonData.columns != null && jsonData.columns.length > 0)
				{
					for(var ic=0;ic<jsonData.columns.length;ic++)
					{
						if(jsonData.columns[ic].hasOwnProperty("measureOrgName"))
						{
							if(jsonData.columns[ic].measureOrgName == jsonData.sortinJs)
							{
								getDataIndex = jsonData.columns[ic].dataIndex;
								getDataIndexSortType = jsonData.columns[ic].sortType;
							}
						}
					}
				}
				var measureData = jsonData.measures;
				measureData.sort(function(a,b){
					if(isNaN(a[getDataIndex]) && isNaN(b[getDataIndex]))
					{
						if((a[getDataIndex].indexOf("<td") > -1 || a[getDataIndex].indexOf("<div") > -1) && (b[getDataIndex].indexOf("<td") > -1 || b[getDataIndex].indexOf("<div") > -1))
						{
							var v1,v2;
							if(a[getDataIndex].indexOf("stateBox") > -1 && b[getDataIndex].indexOf("stateBox") > -1)
							{
								v1 = jQuery(a[getDataIndex]).text();
								v2 = jQuery(b[getDataIndex]).text();
								v1= isNaN(v1) ? isHyphen(v1) : v1;
								v1 = Ext.isNumber(v1) ? v1 : parseFloat(String(v1), 10);
								v2= isNaN(v2) ? isHyphen(v2) : v2;
								v2 = Ext.isNumber(v2) ? v2 : parseFloat(String(v2), 10);
							}
							else
							{
								v1 = a[getDataIndex];
								v2 = b[getDataIndex];
							}
							// transform v1 and v2 here
							if(getDataIndexSortType == "DESC")
								return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
							else
								return v2 > v1 ? 1 : (v2 < v1 ? -1 : 0);
						}
						else
						{
							var v1 = a[getDataIndex];
							var v2 = b[getDataIndex];
							if(getDataIndexSortType == "DESC")
								return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
							else
								return v2 > v1 ? 1 : (v2 < v1 ? -1 : 0);
						}						
					}
					else
					{
						if(getDataIndexSortType == "ASC")
							return parseInt(a[getDataIndex]) - parseInt(b[getDataIndex]); 
						else
							return parseInt(b[getDataIndex]) - parseInt(a[getDataIndex]); 
					}
				});
			}			
		}
		catch (e)
		{
			//console.log("e=-=-=->>",e)
		}
		
		try
		{
			if(jsonData != null && jsonData.hasOwnProperty("isCitraType"))
			{
				if(jsonData.isCitraType)
				{
					var pageSizeCount = jsonData.countJson.pagesizec;
					if(jsonData.measures.length > pageSizeCount)
					{
						var pageNum = jsonData.countJson.pageNum;
						var measureArray = jsonData.measures;
						var dispMeasureArray = [];
						var from = 0;
						var to = 0;
						if(pageNum==1)
						{
							from=0;
							to = pageSizeCount+from;
							//to = from+(pageSizeCount-1);//10+10-1
						}
						else 
						{
							//from=((pageNum-1)*pageSizeCount);//2-1*10
							//to = from+(pageSizeCount-1);//10+10-1
							from = (pageNum*pageSizeCount)-pageSizeCount;
							to = pageSizeCount+from;
						}
						for(var i=from;i<measureArray.length;i++)
						{
							if(i<to)
								dispMeasureArray.push(measureArray[i]);
							else
								break;
						}
						jsonData.measures = dispMeasureArray;
					}
				}
			}
		}
		catch (e)
		{
		}
		

		var OrgUrl=this.url;
		var OrgItemId=this.itemId;
		var storeFields=new Array();
		var columns=new Array();
		var systemColumn={dataIndex:'system'};
		var itemIdGrid = this.itemId;
		if(dashboardName == undefined || dashboardName == null || dashboardName == '')
			dashboardName = 'otherDashboard';
		if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
		{
				var error = jsonData.error;
			if(fromServiceDashboard != null  && (fromServiceDashboard == 'false' || fromServiceDashboard == false))
			{
				systemColumn.text = '<ul class="headerIconLabel" ><li><img style="" src="/final/images/clear.png" class="'+jsonData.columns[0].icon_name+'"/></li><li>'+jsonData.columns[0].text+'</li><li><span style="float:right;margin-left:5px;margin-top:-13px;margin-right:3px;" ><img src="/final/images/Light/grid_sort_down.png" id="first_desc" /></span><span style="float:right;margin-left:5px;margin-top:-13px;margin-right:3px;"><img  src="/final/images/Light/grid_sort_top.png" id="first_asc" /></span></li></ul>';
				systemColumn.menuDisabled = true;
				systemColumn.flex=0.65;

				if(jsonData.columns.length == 7)
				{
					systemColumn.flex=2;
				}
				systemColumn.sortable = true;
				systemColumn.id='first_';
				systemColumn.SortForCompName=jsonData.columns[0].SortForCompName;
				systemColumn.SortTypeForCompName=jsonData.columns[0].SortTypeForCompName;
				if(sortIconIdArr.indexOf('first_') == -1)
					sortIconIdArr.push('first_');
				//systemColumn.SortTypeDirection=jsonData.columns[0].SortTypeDirection;
				//systemColumn.cls = 'textAlignCenter';
				systemColumn.listeners= {
					'headerclick':function(gridheader,eventobj,tml){
						Ext.getCmp('perPanel').sortByGridData(eventobj.dataIndex,null,null,dashboardName);
						Ext.getCmp('perPanel').sortIconDispOperation(eventobj.id);
					}
				};
				systemColumn.renderer=function(value,metaData,record,rowIndex,colIndex){
					var layerModelLink = record.get("layerModelUrl");
					var MaintenanceTime = record.get("MaintenanceTime");
					var configChange = record.get("configChange");

					var widthComp=100;
					var widthExtra=45;
					var extraIcons="";
					var isMaintence=false;
					var isConfigChanges=false;
					if(!Ext.isEmpty(MaintenanceTime) && MaintenanceTime!=null && MaintenanceTime!=undefined)
					{
						widthComp=87;
						widthExtra=25;
						isMaintence=true;
						extraIcons='<div style="margin-top:2px;margin-right:6px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="  class="iconMaintenance" data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="'+MaintenanceTime+'"/></div>';
					}

					if(!Ext.isEmpty(configChange) && configChange!=null && configChange!=undefined)
					{
						if(isMaintence)
						{
							widthComp=80;
							widthExtra=40;
						}
						else
						{
							widthComp=87;
							widthExtra=25;
						}
						isConfigChanges=true;
						var confighref = '/final/monitor/EgConfigChange.jsp?componentName='+configChange;
						extraIcons=extraIcons+'<div id="configchange" style="margin-top:2px;margin-right:6px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onclick="configPop(\''+confighref+'\')" onmouseover="javascript:void(0)" class="iconConfigUser handSymbol"  data-qclass="yellowTip" style="position:absolute;margin:auto;text-align:center" data-qtip="Configuration"/></div>';
					}

					var full_text='<div style="border:0px solid red;margin-top:-2px;float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:block;margin-right:5px;margin-top:-4px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+record.get("systemIconTitle")+'"><a style="position:relative;top:2px" href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></div>';

					if(extraIcons!=null && extraIcons!=undefined && extraIcons!="")
					{
						var styleclass="style=\"float:right;\"";
						if(value.length>30)
						{
							styleclass="";
						}
						//full_text=full_text+'<div style="float:right;margin-left:2px;width:'+widthExtra+'px;">'+extraIcons+'</div>';
						full_text=full_text+'<div style="float:right;width:'+widthExtra+'px;">'+extraIcons+'</div>';
						//-w-//full_text=full_text+'<span '+styleclass+'>'+extraIcons+'</span>';
						//full_text=full_text+extraIcons;
					}

					return full_text;

					// <div style="margin-bottom:-2px" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'"  data-qtip="'+record.get("systemIconTitle")+'"></div>&nbsp;<a href="'+record.get("layerModelUrl")+'"  data-qclass="yellowTip"  data-qtip="'+record.get("systemTitle")+'">'+value+'</a>';
				};
				storeFields.push('system');
				storeFields.push('systemTitle');
				storeFields.push('systemIconClass');
				storeFields.push('systemIconTitle');
				storeFields.push('layerModelUrl');
				storeFields.push('MaintenanceTime');
				storeFields.push('configChange');
				systemColumn.draggable=false;
				columns.push(systemColumn);
			}
			for(var j=1;j<jsonData.columns.length;j++)
			{
				var recMeasureCol=jsonData.columns[j];
				var measureCol=new Object();
				var headerText=recMeasureCol.text;
				var headerUnit=recMeasureCol.unit;
				var headerUnitAvail=recMeasureCol.unit_avail;
				var headerUnitDuar=recMeasureCol.unit_dura;
				var headerWidth="";
				var headFlex;
				var flexEnable=false;
				
				/*if (headerText.length)
				{
					if (j==1)
					{
						headerWidth=165;
					}
					else if (j==2)
					{
						headerWidth=220;
					}
					else if (j==3)
					{
						headerWidth=115;
					}
					else if (j==4)
					{
						headerWidth=120;
					}
					else if (j==5)
					{
						headerWidth=180;
					}
					else if (j==6)
					{
						headerWidth=120;
					}
					else if (j==7)
					{
						headerWidth=180;
					}
					else if (j==8)
					{
						headerWidth=78;
					}
					
					if(jsonData.columns.length > 9)
					{
						if (j==1)
						{
							headFlex=0.6;
							flexEnable=true;
						}
						else if (j==2)
						{
							headFlex=1;
							flexEnable=true;
						}
						else if (j==3)
						{
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==4)
						{
							headFlex=0.5;
							flexEnable=true;
						}
						else if (j==5)
						{
							//headerWidth='180px';
							headFlex=0.7;
							flexEnable=true;
						}
						else if (j==6)
						{
							headFlex=0.8;
							flexEnable=true;
						}
						else if (j==7)
						{
							headFlex=0.65;
							flexEnable=true;
							//headerWidth='130px';
						}
						else if (j==8)
						{
							headFlex=0.8;
							flexEnable=true;
							headerWidth='10px';
						}
					}
					else if(jsonData.columns.length == 8)
					{
						if (j==1)
						{
							headFlex=0.8;
							flexEnable=true;
						}
						else if (j==2)
						{
							headFlex=1;
							flexEnable=true;
						}
						else if (j==3)
						{
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==4)
						{
							headFlex=0.9;
							flexEnable=true;
						}
						else if (j==5)
						{
							//headerWidth='180px';
							headFlex=0.55;
							flexEnable=true;
						}
						else if (j==6)
						{
							headFlex=0.9;
							flexEnable=true;
						}
						else if (j==7)
						{
							headerWidth='10px';
							//headerWidth='130px';
						}
					}
					else if(jsonData.columns.length == 7)
					{
						if (j==1)
						{
							headFlex=1.8;
							flexEnable=true;
						}
						else if (j==2)
						{
							headFlex=2.2;
							flexEnable=true;
						}
						else if (j==3)
						{
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==4)
						{
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==5)
						{
							//headerWidth='180px';
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==6)
						{
							headerWidth='10px';
							flexEnable=false;
						}
					}
					else{
						if (j==1)
						{
							headFlex=0.85;
							flexEnable=true;
						}
						else if (j==2)
						{
							headFlex=1.2;
							flexEnable=true;
						}
						else if (j==3)
						{
							headFlex=0.6;
							flexEnable=true;
						}
						else if (j==4)
						{
							headFlex=0.6;
							flexEnable=true;
						}
						else if (j==5)
						{
							//headerWidth='180px';
							headFlex=0.8;
							flexEnable=true;
						}
						else if (j==6)
						{
							headFlex=0.6;
							flexEnable=true;
							//headerWidth='130px';
						}
						else if (j==7)
						{
							//headerWidth='180px';
							headFlex=0.9;
							flexEnable=true;
						}
						else if (j==8)
						{
							headFlex=0.085;
							flexEnable=true;
						}
					}
				}*/
				//---------Citrix Logon Dashboard header----------------//
				if (headerUnit!=undefined && headerUnitAvail!=undefined && headerUnitDuar!=undefined)
				{
					//measureCol.text = '<img style="margin-right:3px;vertical-align:bottom" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/>'+recMeasureCol.text+'</br>'+recMeasureCol.unit;
					//measureCol.text = '<span style="width:100%;text-align:center;display:inline-block;position:relative;top:0px"><img style="margin-right:3px;vertical-align:bottom;position:relative;top:2px" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/>'+recMeasureCol.text+'</span><ul style="top:3px;font-size:10px !important;text-transform:capitalize !important;list-style-type:none;position:relative"><li style="display:inline-block;width:50%;text-align:center;border-right:1px solid #cdcdcd;background:#b8b8b8;padding-top:1px">'+headerUnitAvail+'</li><li style="display:inline-block;width:50%;text-align:center;background:#b8b8b8;padding-top:1px">'+headerUnitDuar+'&nbsp;<span style="text-transform:lowercase">('+headerUnit+')</span></li></ul>';
					measureCol.text = '<span class="headerIconLabel"><img style="margin-right:3px;vertical-align:bottom;position:relative;top:2px" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/><span>'+recMeasureCol.text+'</span><span style="float:right;margin-left:0px;margin-top:5px;margin-right:3px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:5px;margin-right:3px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span></span><ul class="headerUnit"><li>'+headerUnitAvail+'</li><li style="">'+headerUnitDuar+'&nbsp;<span>('+headerUnit+')</span></li></ul>';

				}
				else
				{
					if(recMeasureCol.text=='DETAILS' || recMeasureCol.text=='details')
					{
						measureCol.text='<span style="float:right;margin-left:0px;margin-top:5px;margin-right:3px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:5px;margin-right:3px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span>';
					}
					else
					{
						if(recMeasureCol.icon_name != undefined && recMeasureCol.icon_name != '')
						{
							//measureCol.text = '<ul class="headerIconLabel" ><li><img style="" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/</li><li ><span>'+recMeasureCol.text+'</span><span style="float:right;margin-left:0px;margin-top:5px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:5px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span></li></ul>';
							if(recMeasureCol.dataIndex != undefined && recMeasureCol.dataIndex == '5MeasureValue')
								measureCol.text = '<ul class="headerIconLabel" ><li><img style="" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/></li><li>'+recMeasureCol.text+'</li><li><span style="float:right;margin-left:5px;margin-top:-21px;margin-right:3px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:-21px;margin-right:3px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span></li></ul>';
							else
								measureCol.text = '<ul class="headerIconLabel" ><li><img style="" src="/final/images/clear.png" class="'+recMeasureCol.icon_name+'"/></li><li>'+recMeasureCol.text+'</li><li><span style="float:right;margin-left:5px;margin-top:-13px;margin-right:3px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:-13px;margin-right:3px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span></li></ul>';
						}
						else
							measureCol.text = '<div style="text-align:center;margin-top:12px;"><span>'+recMeasureCol.text+'</span><span style="float:right;margin-left:0px;margin-top:0px;margin-right:1px;" ><img src="/final/images/Light/grid_sort_down.png" id="'+j+'_desc" /></span><span style="float:right;margin-left:5px;margin-top:0px;margin-right:1px;"><img  src="/final/images/Light/grid_sort_top.png" id="'+j+'_asc" /></span></div>';
					}					
				}
				measureCol.id=j+'_';
				if(sortIconIdArr.indexOf(j+'_') == -1)
					sortIconIdArr.push(j+'_');
				measureCol.cls = 'textAlignCenter';
				measureCol.height = 38;/*----header height fixed---vijay 5/9/2018-----*/
				measureCol.menuDisabled = true;
				measureCol.dataIndex=recMeasureCol.dataIndex;
				if(!Ext.isEmpty(recMeasureCol.text) && recMeasureCol.text == "Session Host")
					measureCol.align='center';
				var length = jsonData.columns.length - 2;
				if(recMeasureCol.dataIndex != undefined && recMeasureCol.dataIndex == length+'MeasureValue')
					measureCol.sortable = false;
				else
					measureCol.sortable = true;
				measureCol.measureOrgName=recMeasureCol.measureOrgName;
				measureCol.sortType=recMeasureCol.sortType;
				if(flexEnable)
				{
					measureCol.flex=headFlex;
				}
				else
				{
					measureCol.width=headerWidth;
				}
				measureCol.listeners= {
					'headerclick':function(gridheader,eventobj,tml){
						var length = jsonData.columns.length - 2;
						if(eventobj.dataIndex != undefined && eventobj.dataIndex == length+'MeasureValue')
							return;
						Ext.getCmp('perPanel').sortByGridData(eventobj.dataIndex,fromMetricView,null,dashboardName);
						Ext.getCmp('perPanel').sortIconDispOperation(eventobj.id);
					}
				};
				measureCol.renderer=function(value,metaData,record,rowIndex,colIndex){
					var currentCol =columns[colIndex];
					var widthAttr=currentCol.dataIndex+"Width";
					var urlAttr=currentCol.dataIndex+"Url";
					var width=record.get(widthAttr);
					var Measureurl=record.get(urlAttr);
					
					if(!Ext.isEmpty(width)){
						var text1 = '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
							  +'<tr>'
							  +'<td>'
							  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
									 +'<tr>'
									 +'<td align="left" width="100%" height="6" class="prog_line" >'
										+'<table width="'+width+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
										+'<tr>'
										+'<td class ="progress_GOOD" width="100%"></td>'
										+'</tr>'
										+'</table>'
									 +'</td>'
									 +'</tr>'
							 +'</table>'
							 +'</td>'
							 +'<td align="right" style="padding-left:5px;width:40px">';
						if(fromServiceDashboard != null  && (fromServiceDashboard == 'true' || fromServiceDashboard == true))
						{
							/*if(Ext.isEmpty(this.parentRef) && !this.parentRef)
								text1 += '<a href='+Measureurl+'>'+value+'</a></td>';
							else
								text1 += '<a target="_parent" href='+Measureurl+'>'+value+'</a></td>';*/
							if(window.parent.hasOwnProperty('monitorPressed'))
								text1 += '<a href='+Measureurl+'>'+value+'</a></td>';
							else
								text1 += '<a target="_parent" href='+Measureurl+'>'+value+'</a></td>';
						}	
						else
							text1 += '<a href='+Measureurl+'>'+value+'</a></td>';
						text1 += '</tr> </table>'
						return text1;
					}
					else if(!Ext.isEmpty(Measureurl)){
						if(value==='-')
						{
							return '<table cellspacing="0" cellpadding="0" border="0" style="width:100%;table-layout:auto;margin:auto;">'
							+'<tr>'
								+'<td align="center" ><div style="margin-top:3px" class="hyphenGray"></div></td>'			// Prem
							+'</tr>'
							+'</table>';
						}
						else
						{
							var text = '';
							//var text = '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;width:100%;margin:auto;">'
							//+'<tr>'
							//	+'<td align="left" style="padding-left:0px;padding-top:2px;width:100%">';
							var dispValuee = "";
							if(value.indexOf("stateBox") > -1)
								dispValuee = jQuery(value).text();
							else if(value.indexOf("state_") > -1)
								dispValuee = value.substring(value.indexOf("&nbsp;")+6);
							else if(value.indexOf("stateTick_") > -1 || value.indexOf("stateWrong_") > -1 || value.indexOf("hyphenGray") > -1)
								dispValuee = "";
							else
								dispValuee = value;
							
							if(dispValuee.trim().length == 0)
								dispValuee = "";

							if(fromServiceDashboard != null  && (fromServiceDashboard == 'true' || fromServiceDashboard == true))
							{
								/*if(Ext.isEmpty(this.parentRef) && !this.parentRef)
									text += '<a href='+Measureurl+'><div style="padding-top:3px;" >'+value+'</div></a>';
								else*/

								if(value.indexOf("<")==-1)
									text += '<a href='+Measureurl+'><div data-qtip="'+dispValuee+'" style="padding-top:3px;overflow: hidden;text-overflow: ellipsis;" >'+value+'</div></a>';
								else
									text += '<a href='+Measureurl+'><div style="padding-top:3px;overflow: hidden;text-overflow: ellipsis;" >'+value+'</div></a>';
							}
							else
							{
								if(value.indexOf('http')==0)
									text += '<a href='+Measureurl+'><div data-qtip="'+dispValuee+'" style="border:0px solid red;position:relative;top:-1px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+value+'</div></a>';
								else
									text += '<a href='+Measureurl+'><div data-qtip="'+dispValuee+'" style="border:0px solid red;position:relative;top:-1px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">'+value+'</div></a>';
							}
							//text += '</tr></table>'
							return text;
						
						}
					}
					else
					{
						if(value==='-')
						{
							//return value;
							return '<table cellspacing="0" cellpadding="0" border="0" style="width:100%;table-layout:auto;margin:auto;">'
							+'<tr>'
								+'<td align="center" ><div style="margin-top:3px" class="hyphenGray"></div></td>'			// Prem
							+'</tr>'
							+'</table>';
						}
						else
						{
							return value;			// Prem
						}
					}
				};
				var fieldType = {
					name:recMeasureCol.dataIndex,
					sortType:recMeasureCol.textType
				}
				storeFields.push(fieldType);
				storeFields.push(recMeasureCol.dataIndex+"Width");
				storeFields.push(recMeasureCol.dataIndex+"Url");
				//columns.push(measureCol);
				measureCol.draggable=false;

				if(recMeasureCol.tempInfo != undefined && recMeasureCol.tempInfo == 'info') 
					columns.splice(0, 0, measureCol);
				else
					columns.push(measureCol);
			}
		}
		else if(this.itemId!=null && this.itemId=='userExperience')
		{
			var isIE = false;
			var isIEEdge = false;
			if (GetIEVersion() == 11) 
				isIE = true;
			else if (GetIEVersion() == 12) 
				isIEEdge = true;
			var isFromMetric=false
			if(fromMetricView!=null && fromMetricView=="true")
				isFromMetric=true;
			
			if(jsonData.error==null || jsonData.error==undefined || jsonData.error=="" || jsonData.error=="undefined" || jsonData.error=="null")
			{
				if(!jsonData.isEndUserOverview)
				{
					systemColumn.text=jsonData.columns[0].text;
					systemColumn.menuDisabled = true;
					systemColumn.width=180;
					systemColumn.locked=true;
					systemColumn.sortable = false;
					systemColumn.draggable = false;
					systemColumn.SortForCompName=jsonData.columns[0].SortForCompName;
					systemColumn.SortTypeForCompName=jsonData.columns[0].SortTypeForCompName;
					//systemColumn.SortTypeDirection=jsonData.columns[0].SortTypeDirection;
					//systemColumn.cls = 'textAlignCenter';

					if(jsonData.hideFirstColumn!=undefined && jsonData.hideFirstColumn!=null && jsonData.hideFirstColumn==true)
					{
						systemColumn.hidden=true;
					}
					
					systemColumn.listeners= {
						'headerclick':function(gridheader,eventobj,tml){
							key=eventobj.SortForCompName;
							//sortState=eventobj.SortTypeForCompName;
							DirProperty=eventobj.dataIndex;
							//sortByMeasure('',sortState,'',fromMetricView);
						}
					};
					systemColumn.renderer=function(value,metaData,record,rowIndex,colIndex){
						var layerModelLink = record.get("layerModelUrl");
						var MaintenanceTime = record.get("MaintenanceTime");
						var configChange = record.get("configChange");
						var icon_title='';
						try
						{
							icon_title=record.get("systemIconTitle");
							if(icon_title == undefined || Ext.isEmpty(icon_title))
								icon_title =record.raw["systemIconTitle"];
						}
						catch (e)
						{
							icon_title='';
						}
						var widthComp=100;
						var widthExtra=45;
						var extraIcons="";
						var isMaintence=false;
						var isConfigChanges=false;
						if(!Ext.isEmpty(MaintenanceTime) && MaintenanceTime!=null && MaintenanceTime!=undefined)
						{
							widthComp=87;
							widthExtra=20;
							isMaintence=true;
							extraIcons='<div style="margin-top:2px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="  class="iconMaintenance" data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="'+MaintenanceTime+'"/></div>';
						}

						if(!Ext.isEmpty(configChange) && configChange!=null && configChange!=undefined)
						{
							if(isMaintence)
							{
								widthComp=80;
								widthExtra=35;
							}
							else
							{
								widthComp=87;
								widthExtra=20;
							}
							isConfigChanges=true;
							var confighref = '/final/monitor/EgConfigChange.jsp?componentName='+configChange;
							extraIcons=extraIcons+'<div id="configchange" style="margin-top:2px;margin-left:3px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onclick="configPop(\''+confighref+'\')" onmouseover="javascript:void(0)" class="iconConfigUser handSymbol"  data-qclass="yellowTip" style="margin:auto;text-align:center;border:0px solid green" data-qtip="Configuration"/></div>';
						}


						var full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></div>';
						
						if(!Ext.isEmpty(jsonData.userType) && jsonData.userType!=null && jsonData.userType!=undefined && jsonData.userType=='CitrixXenVDI')
						{
							if(window.parent.hasOwnProperty('monitorPressed'))
								full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></div>';
							else
								full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'" target="_parent">'+value+'</a></div>';
							
						}

						if(extraIcons!=null && extraIcons!=undefined && extraIcons!="")
						{
							var styleclass="style=\"float:right;\"";
							if(value.length>30)
							{
								styleclass="";
							}
							full_text=full_text+'<div style="float:right;width:'+widthExtra+'px;">'+extraIcons+'</div>';
						}
						return full_text;
					};
					
					storeFields.push('groupingIndex');

					storeFields.push('system');
					storeFields.push('systemTitle');
					storeFields.push('systemIconClass');
					//storeFields.push('systemIconTitle');
					storeFields.push('layerModelUrl');
					//storeFields.push('MaintenanceTime');
					//storeFields.push('configChange');
					columns.push(systemColumn);

					if(!isFromMetric)
					{
						var systemColumn={dataIndex:'system1'};
						systemColumn.text=jsonData.columns[1].text;
						systemColumn.menuDisabled = true;
						systemColumn.width=150;
						systemColumn.locked=true;
						systemColumn.sortable = true;
						systemColumn.draggable = false;
						systemColumn.SortForCompName=jsonData.columns[1].SortForCompName;
						systemColumn.SortTypeForCompName=jsonData.columns[1].SortTypeForCompName;
						//systemColumn.SortTypeDirection=jsonData.columns[0].SortTypeDirection;
						//systemColumn.cls = 'textAlignCenter';
						
						systemColumn.listeners= {
							'headerclick':function(gridheader,eventobj,tml){
								key=eventobj.SortForCompName;
								sortState=eventobj.SortTypeForCompName;
								DirProperty=eventobj.dataIndex;
								sortByMeasure('Host',sortState,'',fromMetricView);
							}
						};
						systemColumn.renderer=function(value,metaData,record,rowIndex,colIndex){
							var layerModelLink = record.get("layerModelUrl1");
							var MaintenanceTime = record.get("MaintenanceTime");
							var configChange = record.get("configChange");

							var icon_title='';
							try
							{
								icon_title=record.get("systemIconTitle");
								if(icon_title == undefined || Ext.isEmpty(icon_title))
									icon_title =record.raw["systemIconTitle"];
							}
							catch (e)
							{
								icon_title='';
							}

							var widthComp=100;
							var widthExtra=45;
							var extraIcons="";
							var isMaintence=false;
							var isConfigChanges=false;
							if(!Ext.isEmpty(MaintenanceTime) && MaintenanceTime!=null && MaintenanceTime!=undefined)
							{
								widthComp=87;
								widthExtra=20;
								isMaintence=true;
								extraIcons='<div style="margin-top:-1px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="  class="iconMaintenance" data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="'+MaintenanceTime+'"/></div>';
							}

							if(!Ext.isEmpty(configChange) && configChange!=null && configChange!=undefined)
							{
								if(isMaintence)
								{
									widthComp=80;
									widthExtra=35;
								}
								else
								{
									widthComp=87;
									widthExtra=20;
								}
								isConfigChanges=true;
								var confighref = '/final/monitor/EgConfigChange.jsp?componentName='+configChange;
								extraIcons=extraIcons+'<div id="configchange" style="margin-top:2px;margin-left:3px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onclick="configPop(\''+confighref+'\')" onmouseover="javascript:void(0)" class="iconConfigUser handSymbol"  data-qclass="yellowTip" style="margin:auto;text-align:center;border:0px solid green" data-qtip="Configuration"/></div>';
							}
							var full_text='<div style="line-height:16px;float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass1")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle1")+'">'+value+'</a></div>';

							if(!Ext.isEmpty(jsonData.userType) && jsonData.userType!=null && jsonData.userType!=undefined && jsonData.userType=='CitrixXenVDI')
							{
								if(window.parent.hasOwnProperty('monitorPressed'))
									full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass1")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle1")+'">'+value+'</a></div>';
								else
									full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:10px;" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass1")+'" data-qtip="'+icon_title+'"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle1")+'" target="_parent">'+value+'</a></div>';
								
							}

							if(extraIcons!=null && extraIcons!=undefined && extraIcons!="")
							{
								var styleclass="style=\"float:right;\"";
								if(value.length>30)
								{
									styleclass="";
								}
								full_text=full_text+'<div style="float:right;width:'+widthExtra+'px;">'+extraIcons+'</div>';
							}
							return full_text;
						};
						
						storeFields.push('system1');
						storeFields.push('systemTitle1');
						storeFields.push('systemIconClass1');
						//storeFields.push('systemIconClass');
						//storeFields.push('systemIconTitle');
						storeFields.push('layerModelUrl1');
						//storeFields.push('MaintenanceTime');
						//storeFields.push('configChange');
						columns.push(systemColumn);
					}
				}

				var widthPad="180px";
				var colLenVal=3;
				var colLen=(jsonData.columns.length-1);
				if(jsonData!=null && jsonData!=undefined && jsonData.columns!=null && jsonData.columns!=undefined && (jsonData.columns.length-1)<5)
				{
					var viewSizeVal=Ext.getBody().getViewSize().width;
					colLenVal=jsonData.columns.length;
					if(viewSizeVal>1400)
					{
						widthPad="980px";
					}
					else
					{
						widthPad="780px";
					}
				}
				
				var col=2;
				if(jsonData.isEndUserOverview)
				{
					col=0;
				}
				else
				{
					if(isFromMetric)
						col=1;
					else
						col=2;
				}

				var ary=[],aryIndex=0,maxLength=0;
				if(!Ext.isEmpty(jsonData) && !Ext.isEmpty(jsonData.measures) && jsonData.measures!="undefiend")
				{
					if(jsonData.measures.length>0)
					{
						for(var j=0;j<jsonData.columns.length;j++)
						{
							ary=[];
							maxLength=0;
							for(var k=0;k<jsonData.measures.length;k++)
							{
								if((jsonData.measures[k][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									ary[aryIndex]=jsonData.measures[k][""+j+"MeasureValue"];
									aryIndex++;
								}
							}
							if(ary.length>0)
							{
								for(var i=0;i<ary.length;i++)
								{
									if( ary[i]!=null && ary[i]!="undefined")
									{
										if(ary[i].indexOf(".")!=-1){
											if(maxLength < (ary[i].substr(0,ary[i].indexOf("."))).length)
											{
												maxLength=(ary[i].substr(0,ary[i].indexOf("."))).length;
											}
										}
										else
										{
											if(maxLength < ary[i].length)
											{
												maxLength = ary[i].length;
											}
										}
									}
								}
							}
							for(var l=0;l<jsonData.measures.length;l++)
							{
								if((jsonData.measures[l][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									jsonData.measures[l][""+j+"MeasureValueLenWidth"]=maxLength*7;
								}
							}
						}
					}
				}
				for(var j=col;j<jsonData.columns.length;j++)
				{
					var recMeasureCol=jsonData.columns[j];
					var measureCol=new Object();
					//measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block">'+recMeasureCol.unit+'</span>';
					
					if(!Ext.isEmpty(recMeasureCol.unit) && recMeasureCol.unit!=null && recMeasureCol.unit!=undefined)
					{
						//measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;text-transform:lowercase">'+recMeasureCol.unit+'</span>';

						measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
						if(isIE || isIEEdge)
							measureCol.text = '<span style="margin-top:0px;display:inline-block;margin-top:-8px">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
					}
					else
					{
						measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span>';
					}

					measureCol.cls = 'textAlignCenter';
					//measureCol.html ='<div>' + '('+recMeasureCol.unit+')</div>';// Prem
					measureCol.menuDisabled = true;
					measureCol.sortable = true;
					measureCol.draggable = false;
					measureCol.dataIndex=recMeasureCol.dataIndex;
					measureCol.measureOrgName=recMeasureCol.measureOrgName;
					measureCol.sortType=recMeasureCol.sortType;
					measureCol.tempLocColName=recMeasureCol.tempLocColName;
					measureCol.tempDispName=recMeasureCol.tempDispName;
					measureCol.tempDate=recMeasureCol.tempDate;
					
					/*var colWid=4;
					var colWid1=18;
					if(recMeasureCol.text.length > colWid)
					{
						//measureCol.width='auto !important';
						if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
						{
							if(colLen<=7)
								measureCol.flex = 1;
							else
								measureCol.width=parseInt(recMeasureCol.columnWith);
						}
						else
						{
							//measureCol.width=(recMeasureCol.text.length*8);
							if(recMeasureCol.text.length >=15)
								measureCol.width=(recMeasureCol.text.length*10);
							else
								measureCol.width=(recMeasureCol.text.length*colWid1);
						}

						try
						{
							if((recMeasureCol.text.length*8)>300)
							{
								widthPad="780px";
							}
							else
							{
								widthPad="180px";
								if(colLenVal<5)
								{
									var viewSizeVal=Ext.getBody().getViewSize().width;
									if(viewSizeVal>1400)
									{
										widthPad="980px";
									}
									else
									{
										widthPad="780px";
									}
								}
							}
						}
						catch (e)
						{
							widthPad="180px";
						}
					}
					else
					{
						if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
						{
							
							if(colLen<=7)
								measureCol.flex = 1;
							else
								measureCol.width=parseInt(recMeasureCol.columnWith);
						}
						else
						{
							//measureCol.width=150;
							measureCol.width=200;
						}
					}

					if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
					{
						//if(false && colLen<=8)
							//measureCol.flex = 1;
					}
					else
					{
						if(colLen<=7)
							measureCol.flex = 0.75;
					}*/
					measureCol.listeners= {
						'headerclick':function(gridheader,eventobj,tml){
							key=eventobj.measureOrgName;
							sortState=eventobj.sortType;
							DirProperty=eventobj.dataIndex;
							temColName=eventobj.tempLocColName;
							temDispName=eventobj.tempDispName;
							temDT=eventobj.tempDate;
							
							if(temDT!=null && temDT!=undefined)
								sortByDDMeasure(temColName,sortState,temDispName,temDT,fromMetricView);
							else
								sortByMeasure(temColName,sortState,temDispName,fromMetricView);

							if(sortState!=null && sortState=="asc")
							{
								sortState="ASC";
							}
							else if(sortState!=null && sortState=="desc")
							{
								sortState="DESC";
							}
						}
					};
					measureCol.renderer=function(value,metaData,record,rowIndex,colIndex)
					{
						var isLocked=false;
						var veryFirstCol = columns[0];
						if(!Ext.isEmpty(veryFirstCol) && veryFirstCol!=undefined && veryFirstCol!=null)
						{
							try
							{
								if(!Ext.isEmpty(veryFirstCol.locked) && veryFirstCol.locked!=undefined && veryFirstCol.locked!=null && veryFirstCol.locked==true)
								{
									isLocked=true;
								}
								else
								{
									isLocked=false;
								}
							}
							catch (e)
							{
								isLocked=false;
							}
						}

						if(isLocked)
						{
							colIndex = colIndex + col;
						}
						
						var currentCol = columns[colIndex];
						var widthAttr=currentCol.dataIndex+"Width";
						var urlAttr=currentCol.dataIndex+"Url";
						var ftype=currentCol.dataIndex+"Ftype";
						var mState=currentCol.dataIndex+"State";
						var LenWidth=currentCol.dataIndex+"LenWidth";
						
						var width=record.get(widthAttr);
						var Measureurl=record.get(urlAttr);
						var meaState=record.get(mState);
						var isftype=record.get(ftype);
						var mLenwidth=record.get(LenWidth);
						var modifiedWidth=42+parseInt(mLenwidth);

						//widthPad='180px';
						
						var strDecimal='';
						var str='';
						//var strVal=value;
						if(!isNaN(parseFloat(value)))
						{
							if(isftype)
							{
								value=value;
							}
							else
							{
								if(value!=null && value.indexOf(".")>-1)
								{
									strDecimal = value.substring(value.indexOf("."));
									str = value.substring(0,value.indexOf("."));
									if(jsonData.isEndUserOverview)
									{
										value='<span class="decimal-align">'+str+'</span><span class="decimal-align2" >'+strDecimal+'</span>';
									}
									else
									{
										if(mLenwidth!=null && mLenwidth!=undefined)
										{
											value='<span class="decimal-align" style="width:'+mLenwidth+'px">'+str+'</span><span class="decimal-align2" style="width:20px">'+strDecimal+'</span>';
										}
										else
										{
											value='<span class="decimal-align" style="width:25px">'+str+'</span><span class="decimal-align2" style="width:20px">'+strDecimal+'</span>';
										}
									}
								}
								else
								{
									if(value.indexOf("Hrs")>-1 || value.indexOf("Mins")>-1 || value.indexOf("Y")>-1 || value.indexOf("M")>-1 || value.indexOf("D")>-1 || value.indexOf("S")>-1)
									{
										var lengthOfVal = value.length;
										mLenwidth = lengthOfVal*6; 
									}
									if(jsonData.columns[colIndex].tempDispName.toLowerCase() == "time since last activity" || jsonData.columns[colIndex].tempDispName.toLowerCase() == "duration")
									{	
										value='<span>'+value+'</span>';
									}
									else if(jsonData.isEndUserOverview)
									{
										value='<span class="decimal-align">'+value+'</span><span class="decimal-align2"></span>';
									}
									else
									{
										if(mLenwidth!=null && mLenwidth!=undefined)
										{
											value='<span class="decimal-align" style="width:'+mLenwidth+'px">'+value+'</span><span class="decimal-align2" style="width:20px"><img src="/final/images/spacer.gif" style="width: 20px;height:1px;"> </span>';
										}
										else
										{
											value='<span class="decimal-align" style="width:25px">'+value+'</span><span class="decimal-align2" style="width:20px"><img src="/final/images/spacer.gif" style="width: 20px;height:1px;"> </span>';
										}
										
									}
								}
							}
						}
						
						if(!Ext.isEmpty(width) && width!=undefined && width!="undefined" && width!="null")
						{
							if(!Ext.isEmpty(jsonData.userType) && jsonData.userType!=null && jsonData.userType!=undefined && jsonData.userType=='CitrixXenVDI')
							{
								return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto">'
									  +'<tr>'
									  +'<td>'
									  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
											 +'<tr>'
											 +'<td align="left" width="100%" height="6" class="prog_line" >'
												+'<a style="width:100%;display:block;height:100%;" href="javascript:void(0);"><table width="'+width+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
												+'<tr>'
												//+'<td class ="progress_GOOD" width="100%"></td>'
												+'<td class ="bar12_'+meaState+'" width="100%"></td>'
												+'</tr>'
												+'</table></a>'
											 +'</td>'
											 +'</tr>'
									 +'</table>'
									 +'</td>'
									 +'<td align="right" style="width:41px">'+value+'</td>'			// Prem
									 +'</tr>'
									 +'</table>';
							}
							else
							{
								return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto">'
									  +'<tr>'
									  +'<td>'
									  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
											 +'<tr>'
											 +'<td align="left" width="100%" height="6" class="prog_line" >'
												+'<a style="width:100%;display:block;height:100%;" href='+Measureurl+'><table width="'+width+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
												+'<tr>'
												//+'<td class ="progress_GOOD" width="100%"></td>'
												+'<td class ="bar12_'+meaState+'" width="100%"></td>'
												+'</tr>'
												+'</table></a>'
											 +'</td>'
											 +'</tr>'
									 +'</table>'
									 +'</td>'
									 +'<td align="right" style="width:41px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
									 +'</tr>'
									 +'</table>';
							}
								
						}
						else if(!Ext.isEmpty(Measureurl) && Measureurl!=null && Measureurl!=undefined && Measureurl!="undefined" && Measureurl!="null"){
							if(jsonData.isEndUserOverview)
							{
								//return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;"><col width="80px"><col width="40px">'
								return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
								+'<tr>'
								+'<td align="right" style="text-align:left;"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
								//+'<td align="right" style="padding-left:5px;width:10px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
								+'</tr>'
								+'</table>';
								//return '<a href='+Measureurl+'>'+value+'</a>';
							}
							else
							{
								//return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;"><col width="80px"><col width="40px">'
								
								if(meaState!=null && meaState!=undefined &&meaState!='null')
								{
									//var data = '<div style="margin-top:-4px;float:left;display:table-cell" class="stateSymbol_'+meaState+'"><img  src="/final/images/clear.png" border="0" /></div><div style="padding-top:1px;display:table-cell;float:left;">'+value+'</div>';
									var data = '<div style="float:left;display:table-cell;margin-right:5px;" class="stateSymbol_'+meaState+'"><img  src="/final/images/clear.png" border="0" /></div><div style="display:table-cell;float:left;">'+value+'</div>';

									if(isIE)
										data = '<div style="float:left;display:table-cell" class="stateSymbol_'+meaState+'"><img  src="/final/images/clear.png" border="0" /></div><div style="display:table-cell;float:left;">'+value+'</div>';

									if(!Ext.isEmpty(jsonData.userType) && jsonData.userType!=null && jsonData.userType!=undefined && jsonData.userType=='CitrixXenVDI')
									{
										return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:'+modifiedWidth+'px">'
										+'<tr>'
										+'<td align="right" style="text-align:center;">'+data+'</td>'			// Prem
										//+'<td align="right" style="padding-left:5px;width:10px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
										+'</tr>'
										+'</table>';
										//return '<a href='+Measureurl+'>'+value+'</a>';
									}
									else
									{
										return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:'+modifiedWidth+'px">'
										+'<tr>'
										+'<td align="right" style="text-align:center;"><a style="display:inline;" href='+Measureurl+'>'+data+'</a></td>'			// Prem
										//+'<td align="right" style="padding-left:5px;width:10px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
										+'</tr>'
										+'</table>';
										//return '<a href='+Measureurl+'>'+value+'</a>';
									}
								}
								else
								{
									return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;">'
										+'<tr>'
										+'<td align="left" style="text-align:left;"><a style="display:inline;" href='+Measureurl+'><div class="stateSymbol_'+meaState+'"></div><div style="float:left;">'+value+'</div></a></td>'			// Prem
										//+'<td align="right" style="padding-left:5px;width:10px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
										+'</tr>'
										+'</table>';
										//return '<a href='+Measureurl+'>'+value+'</a>';

								}
							}
						}
						else
						{
							if(value==='-')
							{
								value='<span class="decimal-align">'+value+'</span><span class="decimal-align2"></span>';
								//value=value;
								return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
								+'<tr>'
									+'<td align="center">'+value+'</td>'			// Prem
								+'</tr>'
								+'</table>';
							}
							else
							{
								//value='<span class="decimal-align">'+value+'</span><span class="decimal-align2"></span>';
								return value;			// Prem
							}
						}
					};
					var fieldType = {
						name:recMeasureCol.dataIndex,
						sortType:recMeasureCol.textType
					}
					storeFields.push(fieldType);
					storeFields.push(recMeasureCol.dataIndex+"Width");
					storeFields.push(recMeasureCol.dataIndex+"Url");
					storeFields.push(recMeasureCol.dataIndex+"Ftype");
					storeFields.push(recMeasureCol.dataIndex+"State");
					storeFields.push(recMeasureCol.dataIndex+"LenWidth");
					columns.push(measureCol);
				}
			}
		}
		else
		{
			var isIE = false;
			var isIEEdge = false;
			if (GetIEVersion() == 11) 
				isIE = true;
			else if (GetIEVersion() == 12) 
				isIEEdge = true;
			if(jsonData.error==null || jsonData.error==undefined || jsonData.error=="" || jsonData.error=="undefined" || jsonData.error=="null")
			{
				var endUserText = 'User Details';
				try
				{
					endUserText = jsonData.measures[0].endUserText;
				}
				catch (w)
				{
					endUserText = 'User Details';
				}
				//endUserText="Comparison";
				endUserText=resourceUsageAnalysis;
				//systemColumn.text='<span style="margin-top:11px;float:left;vertical-align:text-top;margin-left: 6px;">'+jsonData.columns[0].text+'</span>';
				
				//systemColumn.text='<span style="margin-top:8px;float:left;vertical-align:text-top;">'+jsonData.columns[0].text+'</span>';
				systemColumn.text=jsonData.columns[0].text;
				systemColumn.menuDisabled = true;
				systemColumn.width=250;
				systemColumn.locked=true;
				systemColumn.sortable = true;
				systemColumn.draggable = false ;
				systemColumn.align = 'left' ;
				systemColumn.SortForCompName=jsonData.columns[0].SortForCompName;
				systemColumn.SortTypeForCompName=jsonData.columns[0].SortTypeForCompName;
				//systemColumn.SortTypeDirection=jsonData.columns[0].SortTypeDirection;
				//systemColumn.cls = 'textAlignCenter';
				/*if(dashboardName == "ExternalMonitor")
				{
					systemColumn.sortType='asText';
					systemColumn.doSort = function(state) {
						var ds = this.up('grid').store;
						var field = this.getSortParam();
						ds.sort({
							property: field,
							direction: state							
						});
						sortState=state;
						DirProperty=field;
						try
						{
							Ext.getCmp(this.up('grid').up('grid').id).fireEvent('resize',this.up('grid').up('grid'));	
						}
						catch (e)
						{
						}							
					}					
				}
				else*/
				if(true){
					systemColumn.listeners= {
						'headerclick':function(gridheader,eventobj,tml){
							//var key='-2';
							key=eventobj.SortForCompName;
							sortState=eventobj.SortTypeForCompName;
							DirProperty=eventobj.dataIndex;
							var fromPageView=jsonData.pageParams.fromPageView;
							var selectedStateVal=jsonData.pageParams.selectedState;
							var userName=jsonData.pageParams.userName;
							Ext.getCmp('perPanel').sortByGridColumn(key,sortState,fromPageView,selectedStateVal,userName);
						}
					};
				}
				systemColumn.renderer=function(value,metaData,record,rowIndex,colIndex,store)
				{
					var endUserUrlLink = record.get("endUserUrl");
					var layerModelLink = record.get("layerModelUrl");
					var MaintenanceTime = record.get("MaintenanceTime");
					var configChange = record.get("configChange");

					var widthComp=100;
					//var widthExtra=45;
					var extraIcons="";
					var isMaintence=false;
					var isConfigChanges=false;
					var isEnduserLink=false;
					if(!Ext.isEmpty(MaintenanceTime) && MaintenanceTime!=null && MaintenanceTime!=undefined)
					{
						widthComp=87;
						//widthExtra=20;
						isMaintence=true;
						extraIcons='<div style="margin-top:-1px;margin-right:6px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="  class="iconMaintenance" data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="'+MaintenanceTime+'"/></div>';
					}

					if(!Ext.isEmpty(configChange) && configChange!=null && configChange!=undefined)
					{
						if(isMaintence)
						{
							widthComp=80;
							//widthExtra=35;
						}
						else
						{
							widthComp=87;
							//widthExtra=20;
						}
						isConfigChanges=true;
						var confighref = '/final/monitor/EgConfigChange.jsp?componentName='+configChange;
						extraIcons=extraIcons+'<div id="configchange" style="margin-top:1px;margin-right:4px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onclick="configPop(\''+confighref+'\')" onmouseover="javascript:void(0)" class="iconConfigUser handSymbol"  data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="Configuration"/></div>';
					}

					if(!Ext.isEmpty(endUserUrlLink) && endUserUrlLink!=null && endUserUrlLink!=undefined)
					{
						if(isMaintence || isConfigChanges)
						{
							widthComp=80;
							//widthExtra=35;
						}
						else
						{
							widthComp=87;
							//widthExtra=20;
						}
						isEnduserLink=true;
						//extraIcons=extraIcons+'<div id="configchange" style="margin-top:2px;margin-right:4px;float:left;"><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" onclick="configPop(\''+confighref+'\')" onmouseover="javascript:void(0)" class="iconConfigUser handSymbol"  data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="Configuration"/></div>';
						extraIcons=extraIcons+'<div style="margin-top:-1px;margin-right:0px;float:left;"><a href="'+endUserUrlLink+'" ><img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="iconResourceUsage handSymbol"  data-qclass="yellowTip" style="margin:auto;text-align:center" data-qtip="'+endUserText+'"/> </a></div>';
					}
					if(isMaintence && isConfigChanges && isEnduserLink)
						widthComp = 70;
										
					var full_text='<span style="display:inline;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><a href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></span>';
					if(record.get("systemIconClass")!=null && record.get("systemIconClass")!=undefined && record.get("systemIconClass")!="")
					{
						full_text='<div style="float:left;overflow:visible;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:5px;margin-top:-2px;position:absolute" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+record.get("systemIconTitle")+'"><a style="margin-left:22px" href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></div>';
					}
					if(extraIcons!=null && extraIcons!=undefined && extraIcons!="")
					{
						var styleclass="style=\"float:right;\"";
						if(value.length>30)
						{
							styleclass="";
						}
						//full_text=full_text+'<div style="float:right;margin-left:2px;width:'+widthExtra+'px;">'+extraIcons+'</div>';
						//full_text=full_text+'<div style="float:right;width:'+widthExtra+'px;">'+extraIcons+'</div>';
						full_text='<div style="float:left;overflow:hidden;text-overflow:ellipsis;width:'+widthComp+'%;"><img style="vertical-align:middle;display:inline-block;margin-right:5px;margin-top:-2px;position:absolute" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'" data-qtip="'+record.get("systemIconTitle")+'"><a style="margin-left:22px" href='+layerModelLink+'  data-qtip="'+record.get("systemTitle")+'">'+value+'</a></div><div style="float:right;height:16px">'+extraIcons+'</div>';
						//-w-//full_text=full_text+'<span '+styleclass+'>'+extraIcons+'</span>';
						//full_text=full_text+extraIcons;
					}
					//Grouping Rows  -- code start---

					var first = !rowIndex || value !== store.data.items[rowIndex - 1].data.system;
                  	  if (first) { 
                      		var i = rowIndex + 1, span = 1; 
                    		while (i < store.getCount() && value === store.data.items[i].data.system) { 
                        	i++; 
                        	span++; 
                      	} 
                      	//var rowHeight = 24, padding = 4, 
                       	// height = (rowHeight * (i - rowIndex) - padding) + 'px'; 
                     	// metaData.style = 'height:' + height + ';'; 
                      	metaData.tdAttr = 'rowspan = ' + span; 
                   	 } 
                    	else{ 
                      		//metaData.tdAttr='style="display:none;"'; 
							metaData.tdAttr='style="visibility:hidden;"'; 
                    	} 

                    	return first ? full_text : ''; 

					//Grouping Rows  -- code end---

					//return full_text;

					// <div style="margin-bottom:-2px" data-qclass="yellowTip" class="columnIcon '+record.get("systemIconClass")+'"  data-qtip="'+record.get("systemIconTitle")+'"></div>&nbsp;<a href="'+record.get("layerModelUrl")+'"  data-qclass="yellowTip"  data-qtip="'+record.get("systemTitle")+'">'+value+'</a>';
				};
				storeFields.push('system');
				storeFields.push('systemTitle');
				storeFields.push('systemIconClass');
				storeFields.push('systemIconTitle');
				storeFields.push('endUserUrl');
				storeFields.push('layerModelUrl');
				storeFields.push('MaintenanceTime');
				storeFields.push('configChange');
				systemColumn.draggable=false;
				columns.push(systemColumn);

				var widthPad="180px";
				var colLenVal=3;
				var colLen=(jsonData.columns.length-1);

				var ary=[],aryIndex=0,maxLength=0;
				if(!Ext.isEmpty(jsonData) && !Ext.isEmpty(jsonData.measures) && jsonData.measures!="undefiend")
				{
					if(jsonData.measures.length>0)
					{
						for(var j=0;j<jsonData.columns.length;j++)
						{
							ary=[];
							maxLength=0;
							for(var k=0;k<jsonData.measures.length;k++)
							{
								if((jsonData.measures[k][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[k][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									ary[aryIndex]=jsonData.measures[k][""+j+"MeasureValue"];
									aryIndex++;
								}
							}
							if(ary.length>0)
							{
								for(var i=0;i<ary.length;i++)
								{
									if( ary[i]!=null && ary[i]!="undefined")
									{
										if(ary[i].indexOf(".")!=-1){
											if(maxLength < (ary[i].substr(0,ary[i].indexOf("."))).length)
											{
												maxLength=(ary[i].substr(0,ary[i].indexOf("."))).length;
											}
										}
										else
										{
											if(maxLength < ary[i].length)
											{
												maxLength = ary[i].length;
											}
										}
									}
								}
							}
							for(var l=0;l<jsonData.measures.length;l++)
							{
								if((jsonData.measures[l][""+j+"MeasureValueLenWidth"])>0 && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="-" && jsonData.measures[l][""+j+"MeasureValueLenWidth"]!="undefined")
								{
									jsonData.measures[l][""+j+"MeasureValueLenWidth"]=maxLength*7;
								}
							}
						}
					}
				}

				if(jsonData!=null && jsonData!=undefined && jsonData.columns!=null && jsonData.columns!=undefined && (jsonData.columns.length-1)<5)
				{
					var viewSizeVal=Ext.getBody().getViewSize().width;
					colLenVal=jsonData.columns.length;
					if(viewSizeVal>1400)
					{
						widthPad="980px";
					}
					else
					{
						widthPad="780px";
					}
				}

				for(var j=1;j<jsonData.columns.length;j++)
				{
					var recMeasureCol=jsonData.columns[j];
					var measureCol=new Object();

					if(!Ext.isEmpty(recMeasureCol.unit) && recMeasureCol.unit!=null && recMeasureCol.unit!=undefined)
					{
						measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
						if(isIE || isIEEdge)
							measureCol.text = '<span>'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
					}
					else
					{
						measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span>';
						if(isIE || isIEEdge)
							measureCol.text = '<span>'+recMeasureCol.text+'</span>';
					}
					//masureCol.text = '<span style="margin-top:2px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText">'+recMeasureCol.unit+'</span>';
					measureCol.cls = 'textAlignCenter';
					//measureCol.html ='<div>' + '('+recMeasureCol.unit+')</div>';// Prem
					measureCol.menuDisabled = true;
					if(dashboardName == "ExternalMonitor" && recMeasureCol.text.toLowerCase() == "script")						
						measureCol.sortable = false;
					else
					{	
						if(!Ext.isEmpty(recMeasureCol.sortable))
							measureCol.sortable = recMeasureCol.sortable;
						else
							measureCol.sortable = true;
					}
					//if(colLen<=8)
						//measureCol.flex = 1;
					measureCol.dataIndex=recMeasureCol.dataIndex;
					measureCol.measureOrgName=recMeasureCol.measureOrgName;
					measureCol.sortType=recMeasureCol.sortType;
					/*if(recMeasureCol.text.length > 20)
					{
						//measureCol.width='auto !important';
						if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
						{
							if(colLen<=8)
								measureCol.flex = 1;
							else
								measureCol.width=parseInt(recMeasureCol.columnWith);
						}
						else
						{
							measureCol.width=(recMeasureCol.text.length*8);
						}

						try
						{
							if((recMeasureCol.text.length*8)>300)
							{
								widthPad="780px";
							}
							else
							{
								widthPad="180px";
								if(colLenVal<5)
								{
									var viewSizeVal=Ext.getBody().getViewSize().width;
									if(viewSizeVal>1400)
									{
										widthPad="980px";
									}
									else
									{
										widthPad="780px";
									}
								}
							}
						}
						catch (e)
						{
							widthPad="180px";
						}
					}
					else
					{
						if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
						{
							if(colLen<=8)
								measureCol.flex = 1;
							else
								measureCol.width=parseInt(recMeasureCol.columnWith);
						}
						else
						{
							measureCol.width=150;
						}
					}

					if(recMeasureCol.columnWith!=null && recMeasureCol.columnWith!=undefined && recMeasureCol.columnWith!="" && recMeasureCol.columnWith!="-1")
					{
						//if(false && colLen<=8)
							//measureCol.flex = 1;
					}
					else
					{
						if(colLen<=8)
							//measureCol.flex = 0.75;
					}*/

					//SCRIPT NAME SKIPPING SORTING FUNCTION

					/*if(dashboardName == "ExternalMonitor")
					{
						measureCol.sortType='asText';
						measureCol.doSort = function(state) {
							var ds = this.up('grid').store;
							var field = this.getSortParam();
							ds.sort({
								property: field,
								direction: state,
								sorterFn: function(v1, v2){
									v1 = v1.get(field);
									v2 = v2.get(field);
									// transform v1 and v2 here
									if(isNaN(v1) && isNaN(v2))
									{
										if(v1.indexOf("stateBox") > -1 && v2.indexOf("stateBox") > -1)
										{
											v1 = jQuery(v1).text();
											v2 = jQuery(v2).text();
											v1= isNaN(v1) ? isHyphen(v1) : v1;
											v1 = Ext.isNumber(v1) ? v1 : parseFloat(String(v1), 10);
											v2= isNaN(v2) ? isHyphen(v2) : v2;
											v2 = Ext.isNumber(v2) ? v2 : parseFloat(String(v2), 10);
										}
										// transform v1 and v2 here
										return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
									}
									else
									{
										v1= isNaN(v1) ? isHyphen(v1) : v1;
										v1 = Ext.isNumber(v1) ? v1 : parseFloat(String(v1), 10);
										v2= isNaN(v2) ? isHyphen(v2) : v2;
										v2 = Ext.isNumber(v2) ? v2 : parseFloat(String(v2), 10);
										// transform v1 and v2 here
										return (v1 > v2) ? 1 : ((v1 < v2) ? -1 : 0);
									}
								}
							});
							sortState=state;
							DirProperty=field;
							try
							{
								Ext.getCmp(this.up('grid').up('grid').id).fireEvent('resize',this.up('grid').up('grid'));	
							}
							catch (e)
							{
							}							
						}
					}
					else*/
					if(true){
						measureCol.listeners= {
							'headerclick':function(gridheader,eventobj,tml){
								key=eventobj.measureOrgName;
								sortState=eventobj.sortType;
								DirProperty=eventobj.dataIndex;
								var fromPageView=jsonData.pageParams.fromPageView;
								var selectedStateVal=jsonData.pageParams.selectedState;
								var userName=jsonData.pageParams.userName;

								var doSort = true;								
								if(!Ext.isEmpty(eventobj.sortable))
									doSort = eventobj.sortable;
								
								if(doSort)
								{
									if(key == "-")
									{
										var ds = this.up('grid').store;
										var field = this.getSortParam();
										ds.sort({
											property: field,
											direction: state
										});										
									}
									else
										Ext.getCmp('perPanel').sortByGridColumn(key,sortState,fromPageView,selectedStateVal,userName);
								}
							}
						};
					}					
					measureCol.renderer=function(value,metaData,record,rowIndex,colIndex,store)
					{
						var isLocked=false;

						var veryFirstCol = columns[0];
						if(!Ext.isEmpty(veryFirstCol) && veryFirstCol!=undefined && veryFirstCol!=null)
						{
							try
							{
								if(!Ext.isEmpty(veryFirstCol.locked) && veryFirstCol.locked!=undefined && veryFirstCol.locked!=null && veryFirstCol.locked==true)
								{
									isLocked=true;
								}
								else
								{
									isLocked=false;
								}
							}
							catch (e)
							{
								isLocked=false;
							}
						}

						if(isLocked)
						{
							colIndex = colIndex + 1;
						}
						
						var temValue = value;
						var currentCol = columns[colIndex];
						var widthAttr=currentCol.dataIndex+"Width";
						var urlAttr=currentCol.dataIndex+"Url";
						var imgAttr=currentCol.dataIndex+"Imglink";
						var width=record.get(widthAttr);
						var Measureurl=record.get(urlAttr);
						var MeasureImglink=record.get(imgAttr);						
						
						//client Emulation code start
						var isGraphColumn = false;						
						if(record.get(currentCol.dataIndex) != null && record.get(currentCol.dataIndex) != "undefiend" && currentCol.dataIndex.indexOf("Graph")>-1)
							isGraphColumn = true;						
						
						if(isGraphColumn)
						{										
							if(!Ext.isEmpty(record.get(currentCol.dataIndex)) && record.get(currentCol.dataIndex).data.length>0)	
								return '<div id="ClientEmulation_'+currentCol.dataIndex+"_"+rowIndex+'" style="height:15px;margin-top:-1px;" class="measure_count"></div>';						
							else
								return '<div style="text-align:center">-</div>';												
						}
						//client Emulation code end

						var strDecimal='';
						var str='';
						try
						{
							if(!isNaN(parseFloat(value)))
							{
								var val_ary = value.split(".");

								if(value!=null && value.indexOf(".")>-1 && val_ary.length == 1 )
								{
									strDecimal = value.substring(value.indexOf("."));
									str = value.substring(0,value.indexOf("."));
									value='<span><span class="decimal-align">'+str+'</span><span class="decimal-align2">'+strDecimal+'</span></span>';
								}
								else if(value!=null && (value.indexOf("Days")>-1 || value.indexOf("Hrs")>-1 || value.indexOf("Mins")>-1 || value.indexOf("Secs")>-1))
								{
									value='<span style="white-space:nowrap !important;margin-left:0px !important;text-alaign:left;">'+value+'</span>';
								}
								else
								{
									//if(val_ary.length > 1 )
										//value='<center>'+value+'</center>';
									if(value!=null && value.indexOf(".") != -1 && val_ary.length == 2 && value.indexOf("_")==-1)
									{
										strDecimal = value.substring(value.indexOf("."));
										str = value.substring(0,value.indexOf("."));
										value='<span class="decimal-align dottedText">'+str+'</span><span class="decimal-align2 dottedText">'+strDecimal+'</span>';
									}
									else
									{
										//if(val_ary.length != 4 && val_ary.length != 1)
										if(val_ary.length != 4 && value.indexOf("_")==-1)
										{
											//value='<span class="decimal-align" >'+value+'</span>';
											value='<span>'+value+'</span>';
										}										
									}
								}
							}
							else
							{
								if(value == '-' || value == "No metrics configured")
									value='<p align="center">'+value+'</p>';								
								else
									value='<p>'+value+'</p>';
							}
						}
						catch (ee)
						{
							value='<p align="center">'+value+'</p>';
						}
						
						if(temValue == 'No metrics configured')
						{
							var first = !rowIndex || temValue !== store.data.items[rowIndex].data['0MeasureValue'];
							  if (first) { 
									var i = rowIndex +1, span = 1; 
									while (i < store.getCount() && temValue === store.data.items[rowIndex].data['0MeasureValue']) { 
									i++; 
									span++; 
								} 
								metaData.tdAttr = 'rowspan = ' + span; 
							 } 
								else{ 
									//metaData.tdAttr='style="display:none;"'; 
									metaData.tdAttr='style="visibility:hidden;"';
								} 

								return first ? value : ''; 
						}
						
						if(!Ext.isEmpty(width))
						{
							return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
								  +'<tr>'
								  +'<td>'
								  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
										 +'<tr>'
										 +'<td align="left" width="100%" height="6" class="prog_line" >'
											+'<a href='+Measureurl+'><table width="'+width+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
											+'<tr>'
											+'<td class ="progress_GOOD" width="100%"></td>'
											+'</tr>'
											+'</table></a>'
										 +'</td>'
										 +'</tr>'
								 +'</table>'
								 +'</td>'
								 +'<td align="right" style="padding-left:5px;width:45px"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
								 +'</tr>'
								 +'</table>';
						}
						else if(!Ext.isEmpty(Measureurl) && !Ext.isEmpty(MeasureImglink))
						{
							return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
								+'<tr>'
									//+'<td align="right" style="padding-left:5px;width:'+widthPad+';"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
									+'<td style="padding-left:20px;"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
									+'<td style="padding-left:5px;">'+MeasureImglink+'</td>'
								+'</tr>'
								+'</table>';
						}
						else if(!Ext.isEmpty(Measureurl))
						{
							/*return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;">'
								+'<tr>'
									//+'<td align="right" style="padding-left:5px;width:'+widthPad+';"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
									+'<td style="width:'+widthPad+';"><a href='+Measureurl+'>'+value+'</a></td>'			// Prem
								+'</tr>'
								+'</table>';*/
							var textTemValue = jQuery(temValue).text();
							if(!Ext.isEmpty(textTemValue))
								temValue = textTemValue;
							else
							{
								try
								{
									 if(temValue.indexOf("state") > -1)
										 temValue = "";
								}
								catch (e)
								{
								}
							}

							return '<div style="width:100%;text-align:center" data-qtip="'+temValue+'"><a href='+Measureurl+'>'+value+'</a></div>';
						}
						else
						{
							if(value==='-')
							{
								value='<span class="decimal-align">'+value+'</span>';
								//return value;
								return '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;">'
								+'<tr>'
									//+'<td align="right" style="padding-left:5px;width:'+widthPad+'">'+value+'</td>'			// Prem
									+'<td style="padding-left:5px;width:'+widthPad+'">'+value+'</td>'			// Prem
								+'</tr>'
								+'</table>';
							}
							else
							{
								return value;			// Prem
							}
						}
					};
					var fieldType = {
						name:recMeasureCol.dataIndex,
						sortType:recMeasureCol.textType
					}
					storeFields.push(fieldType);
					storeFields.push(recMeasureCol.dataIndex+"Width");
					storeFields.push(recMeasureCol.dataIndex+"Url");
					storeFields.push(recMeasureCol.dataIndex+"Imglink");
					measureCol.draggable=false;
					columns.push(measureCol);
				}
			}
		}
		
		if(sortState!=null && sortState=="asc")
		{
			sortState="ASC";
		}
		else if(sortState!=null && sortState=="desc")
		{
			sortState="DESC";
		}
		
		var isGroupField="";
		var isremoteGroup=false;
		if(this.itemId!=null && this.itemId=='userExperience')
		{
			if(!Ext.isEmpty(jsonData.measures)){
				if(!Ext.isEmpty(jsonData.groupingGrid) && (jsonData.groupingGrid==true || jsonData.groupingGrid=='true')){
					isGroupField="groupingIndex";
					isremoteGroup=true;
				}
			}
		}
		else
		{
			isGroupField="";
			isremoteGroup=false;
		}
		
		var remoteSortEnable = true;
		//if(dashboardName == "ExternalMonitor")
			//remoteSortEnable = false;

		var gridStore=Ext.create('Ext.data.Store',{
			fields:storeFields,
			//pageSize : 10,
			autoLoad : false,
			remoteSort:remoteSortEnable,
			autoDestroy:false,
			//sortable:true,
			proxy: {
				type: 'memory',
				reader: {
					type: 'json',
					root:'measures',
					totalProperty: 'totalCount',
				}
			},
			data:jsonData,
			tempData:jsonData,
			//groupField:isGroupField,
			groupField:isGroupField,
			remoteGroup:isremoteGroup,
			sortOnLoad: true,
			sorters:
			{
				property: DirProperty,
				direction: sortState
			}
		});
		//this.removeAll();

		if(this.itemId!=null && this.itemId=='userExperience')
		{
			var empTxt=searchComponents;
			if(jsonData.pageParams!=null && jsonData.pageParams!=undefined && jsonData.pageParams.selectedPage=='System')
				empTxt=searchSystems;
			
		//if(this.itemId=='logonSimualtion' || this.itemId=='horizonlogonSimualtion')
		if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
			empTxt=searchSimulations;
			
			if(this.itemId=='userExperience')
				empTxt=searchRecords;
			
			var addContainer=Ext.create('Ext.container.Container',{
				xtype:'container',
				flex:1,
				layout:{
					type:'vbox',
					align:'stretch'
				},
				items:[/*{
					xtype:'panel',
					layout:{type:'hbox',pack:'left'},
					padding:10,
					height:70,
					id:'logonFormPanel',
					cls:'formOuter',
					items:toolbarConfig,
					hidden:hideComboandSearch
				},*/{
						xtype:'panel',
						cls:'dataPanel',
						autoScroll:false,
						scroll:false,
						flex:1,
						margin:0,
						//style:{'border':'1px solid red'},
						layout:{
							type:'vbox',
							align:'stretch'
						},
						id:'gridContainer'
				}]
			});

			//if(gridStore.getCount()>0)
			if(gridStore!=null)
			{
				var gridPanel = this.down('generalMeasuresGrid');

				/*if(!Ext.isEmpty(gridPanel) && gridPanel!=null)
				{
					gridPanel.reconfigure(gridStore, columns);
					return;
				}*/

				if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') > -1)
				{
					gridPanel.getStore().loadRawData(jsonData);
				}
				else
				{
					this.add(addContainer);

					var systemGrid=null;
					if(gridStore.getCount()==0)
					{
						systemGrid=Ext.create('Ext.panel.Panel',{
							//cls:'gridSkin gridSkin_locking',
							//ui:'newGridPanel',
							margin:10,
							frame:false,
							//style:{'border':'0px !important'},
							border:false,
							layout:'fit',
							flex:1,
							items: [{
									xtype: 'container',
									//padding: 50,
									style: {
									'text-align': 'center'
									},
									//html: '<div class = "iconInformation" style="margin:19% auto 0px auto"></div><div>'+searchNo+' '+empTxt+' '+searchFound+'</div>'
									html:'<div style="height:100%;width:100%;display:table"><div class="msgFont" style="display:table-cell;vertical-align:middle"> <div class="iconInformation" style="margin:0px auto"></div><div style="text-align:center">'+searchNo+' '+empTxt+' '+searchFound+'</div></div></div>'
									//html: '<div class = "iconExclamation" style="margin:15% auto 0px auto"></div><div>No Records Found! </div>'
								}
							],
							isFormHide:hideComboandSearch,
							/*listeners:{
								'afterrender':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								},
								'resize':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								}
							}*/
						});
					}
					else
					{
						var gridCls="";
						var isLock=false;
						var isBorder = true;
						if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
						{
							//gridCls="iconGrid ddGridLockView";
							gridCls="newGridPanel ddGridLockView";
							isLock=false;
							isBorder = false;
						}
						else
						{
							//gridCls="gridSkin gridSkin_locking ddGridLockView";
							gridCls="newGridPanel ddGridLockView";
							isBorder = false;
							if (!Ext.isEmpty(endUserOverviewFlag) && endUserOverviewFlag!=undefined && (endUserOverviewFlag==true || endUserOverviewFlag=='true') )
								isLock = false;
							else
								isLock = true;
						}

						systemGrid=Ext.create('GeneralMeasuresGrid',{
							plugins:Ext.create('Ext.ux.AutoColumnWithLockingPlugin'),									
							columns:columns,
							itemId:'generalMeasuresGrid',
							//cls:gridCls,
							ui:gridCls,
							//margin:10,
							//layout:'fit',
							enableLocking:isLock,
							flex:1,
							border:isBorder,
							store:gridStore,
							someFun:Ext.emptyFn,
							scroll:true,
							autoScroll:true,
							features: [{id:'group',ftype:'grouping',collapsible:false,groupHeaderTpl: '{name}',hideHeaders:true }],
							//features: [{ftype:'grouping',collapsible:false}],
							viewConfig: {
								cls:'gridGrphide',
								listeners:{
									viewready:function(){
										systemGrid.someFun();
									}
								},
								emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>'
							},
							/*listeners:{
								'columnresize':function( ct, column, width, eOpts )
								{
									try
									{
										var tempColumnDataIndex= (Ext.decode(Ext.util.Cookies.get('tempColumnDataIndex')));
										var tempColumnObj= (Ext.decode(Ext.util.Cookies.get('tempColumnObj')));
										if(tempColumnDataIndex == undefined || tempColumnDataIndex == null)
											tempColumnDataIndex = [];
										if(tempColumnObj == undefined || tempColumnObj == null)
											tempColumnObj = [];
									}
									catch (er)
									{
										var tempColumnDataIndex=[];
										var tempColumnObj=[];
									}
									if(tempColumnDataIndex.indexOf(column.dataIndex) != -1)
									{
										var indexVal = [];
										for (var c=0; c<tempColumnDataIndex.length; c++) 
										{
											if(tempColumnDataIndex[c] == column.dataIndex) 
											{
												indexVal.push(c);
											}
										}
										for(var r=0;r<indexVal.length-1;r++){
											if(tempColumnObj[indexVal[r]].compType == compType)
											{
												tempColumnDataIndex.splice(indexVal[r], 1);
												tempColumnObj.splice(indexVal[r], 1);
											}
										}
										tempColumnDataIndex.push(column.dataIndex);
										tempColumnObj.push({
											"dataIndex":column.dataIndex,
											"measureOrgName":column.measureOrgName,
											"dashboardName":dashboardName,
											"compType":compType,
											"width":width
										});
									}
									else
									{
										tempColumnDataIndex.push(column.dataIndex);
										tempColumnObj.push({
											"dataIndex":column.dataIndex,
											"measureOrgName":column.measureOrgName,
											"dashboardName":dashboardName,
											"compType":compType,
											"width":width
										});
									}
									//Ext.util.Cookies.clear('tempColumnObj');
									//Ext.util.Cookies.clear('tempColumnDataIndex');
									Ext.util.Cookies.set('tempColumnObj',Ext.encode(tempColumnObj));
									Ext.util.Cookies.set('tempColumnDataIndex',Ext.encode(tempColumnDataIndex));
								}
							},*/
							dockedItems: [{
								hidden:jsonData.countJson['isHidePaging'],
								xtype: 'pagingtoolbar',
								style:{'border-top':'none !important'},
								id:'pagingtoolbarCustom',
								store: gridStore,   // same store GridPanel is using
								dock: 'bottom',
								//cls:'pagingtoolbar',
								cls:'newPagination',
								//..afterTextItem:2,
								afterPageText:'of '+ totalPageNo,
								displayInfo: true,
								displayMsg: disptxt+' '+ gridMsg,
								moveFirst:function()
								{
									if(OrgItemId=='system' || OrgItemId=='System')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
										}
									}
									
									else if(OrgItemId=='components' || OrgItemId=='Components')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
										}
									}
									else
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
											userUrl = glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
											userUrl = glUrl;
										}
									}
									Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo,fromMetricView);
									RefpageVal='1';
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
								},
								movePrevious:function()
								{
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
										return;
									else
									{
										pageVal = pageVal - 1;
										
										if(OrgItemId=='system' || OrgItemId=='System')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										
										else if(OrgItemId=='components' || OrgItemId=='Components')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
												userUrl = glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
												userUrl = glUrl;
											}
										}
										RefpageVal=pageVal;
										Reftot=totalRecords;
										ReftotalPageno=totalPageNo;
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
									}

									/*if(prevArray.length > 2)
									{
										pageCount = prevArray[prevArray.length-2];
										var a = new Array();
										for(var i=0;i<prevArray.length-2;i++)
											a.push(prevArray[i]);
										
										prevArray = new Array();
										prevArray = a;
									}
									else
										pageCount =1;

									if(currentPage > 1)
									{
										pageNoMain=currentPage-1;
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(currentPage-1,"fromPagination",totalPage);
									}
									else
									{
										pageNoMain=1;
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(1,"fromPagination",totalPage);
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
									}*/
								},
								moveNext : function()
								{
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									
									if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
										return;
									else if(pageVal==totalPageNo)
									{
										Ext.Msg.alert('alert','No More Pages');
										return;
									}
									else
									{
										pageVal = pageVal + 1;
										if(OrgItemId=='system' || OrgItemId=='System')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else if(OrgItemId=='components' || OrgItemId=='Components')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
												userUrl = glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
												userUrl = glUrl;
											}
										}
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
									}
									RefpageVal=pageVal;
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
									//pageNoMain=pageNoMain+1;
									//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(currentPage+1,"fromPagination",totalPage);
									//Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
								},
								moveLast : function()
								{
									//pageNoMain = totalPage;
									//if(!seqHideFlag)
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(totalPage,"fromPagination",totalPage);
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									if(pageVal==totalPageNo)
									{
										Ext.Msg.alert('alert','No More Pages');
										return;
									}
									
									if(OrgItemId=='system' || OrgItemId=='System')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
										}
									}
									
									else if(OrgItemId=='components' || OrgItemId=='Components')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
										}
									}
									else
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
											userUrl = glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
											userUrl = glUrl;
										}
									}
									Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,totalPageNo,totalPageNo,fromMetricView);
									RefpageVal=totalPageNo;
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
									/*else
									{
										Ext.Msg.alert('Status','Direct Page Movement Not Applicable for this Test');
										return;
									}*/
								},
								/*doRefresh:function(){
									pageNoMain=1;
									//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(1,"fromPagination",totalPage);
									Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
								},*/
								onPagingKeyDown:function(field, e)
								{
									var me = this,
									k = e.getKey();
									if (k == e.RETURN) 
									{
										var pageVal = Ext.getCmp('afterTextColumn').getValue();
										if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
											return;
										else if(pageVal > totalPageNo)
										{
											Ext.Msg.alert('alert','No More Pages');
											return;
										}
										else
										{
											RefpageVal=pageVal;
											Reftot=totalRecords;
											ReftotalPageno=totalPageNo;
											
											if(OrgItemId=='system' || OrgItemId=='System')
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
												}
											}
											
											else if(OrgItemId=='components' || OrgItemId=='Components')
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
												}
											}
											else
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
													userUrl = glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
													userUrl = glUrl;
												}
											}

											Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
										}
									}
								},
								emptyMsg: "No topics to display"
							}],
							//tbar:toolbarConfig,
							frame:false,
							emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>',
							//isFormHide:hideComboandSearch,
							/*listeners:{
								'afterrender':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								},
								'resize':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								}
							}*/
							//cls:'systemsGrid'
						});
					}

					//var fromPageView=jsonData.pageParams.fromPageView;
					var hideComboandSearch=true;
					//if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
						//hideComboandSearch=false;
					if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
					{
						var agentSelectredVal;
						var len = 0;
						try
						{
							len= jsonData.externalAgentObj.externalAgentArr.length;
						}
						catch (e)
						{
						}
							
						if(jsonData.externalAgentObj.selectedextAgentType != undefined)
							agentSelectredVal=jsonData.externalAgentObj.selectedextAgentType;
						else if(len  > 2 )
							agentSelectredVal='all';
						else 
							agentSelectredVal='Not Applicable';

						var extAgentStore = Ext.create('Ext.data.Store',{
							fields:['name','value'],
							proxy:{
								type: 'memory',
								reader: {
									type: 'json',
									root:'externalAgentArr'
								}
							},
							data:jsonData.externalAgentObj
						});
						var extAgentCombo={
							xtype:'combo',
							id:'extAgent',
							labelAlign : 'left',
							editable : false,
							store:extAgentStore,
							labelSeparator:'',
							cls : 'dropdown',
							displayField: 'name',
							valueField: 'value',
							trigerAction:'all',
							fieldLabel:extagent+':',
						
							labelWidth:95,
							queryMode: 'local',
							margin:'0 0 0 10',
						
							//value:'filterByCombo'
							//value:'Chennai'
							value:agentSelectredVal
						};
						
						if(hideComboandSearch)
						{
							systemGrid.addDocked({
								xtype: 'toolbar',
								padding:'5 0 5 0',
								//dock: 'top',
								layout:'hbox',
								//cls:'formOuter',
								//style:{'background-color':'transparent'},
								items: [extAgentCombo,'->',nickName]
							});
						}
						Ext.getCmp("logonFormPanel").setVisible(false);
					}
					else
					{
						//if(hideComboandSearch)
						/*{
							systemGrid.addDocked({
								xtype: 'toolbar',
								padding:'5 0 5 0',
								//dock: 'top',
								layout:'hbox',
								//cls:'formOuter',
								//items: [nickName]
							});
						}*/
					}
					
					//this.add(addContainer);
					Ext.getCmp("gridContainer").add(systemGrid);
					Ext.getCmp("gridContainer").doComponentLayout();
					
				}
			}
			else
			{
				var dockedItems = me.getDockedItems('toolbar');
				for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
					me.removeDocked(dockedItems[dockedCounter]);
				}

				var error_msg=jsonData.screenLabels[this.screenLabelPath+'.noDataMsg'];
				var error_panel={
						xtype:'emptypanel',
						//tbar:toolbarConfig,
						style:{'border':'0px !important'},
						border:false,
						frame:false,
						layout:'fit',
						flex:1,
						bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						cls:'egDummyClass',
						items: [{
								xtype: 'container',
								//padding: 50,
								style: {
									'text-align': 'center'
								},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
								}
						]

					//	xtype:'errorpanel',
					//	errorMsg:error_msg,
					//	tbar:toolbarConfig
				};

				var fromPageView=jsonData.pageParams.fromPageView;
				var hideComboandSearch=true;
				if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
					hideComboandSearch=false;
				if(hideComboandSearch)
				{
					error_panel.addDocked({
						xtype: 'toolbar',
            ui:'topToolbarBorder',
						dock: 'top',
						cls:'linebottom toolbarBg',
						//bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						//style:{'background-color':'transparent !important','background-image':'none !important'},
						padding:'1 10 1 2',
						items: toolbarConfig
					});
				}
				this.add(error_panel);
			}
		}
		else
		{
			var toolbarConfig=this.formToolbar(jsonData);

			
			//var empTxt="Components";
			var empTxt=searchComponents;
			if(jsonData.pageParams!=null && jsonData.pageParams!=undefined && jsonData.pageParams.selectedPage=='System')
			{
				//empTxt="Systems";
				empTxt=searchSystems;
			}
			if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
			{
				//empTxt="Simulations";
				empTxt=searchSimulations;
			}
			var nickName=null;
			nickName={
				xtype:'trigger',
				//style:{'float':'right'},
				fieldLabel:'',
				cls: 'whitedropdown_search',
				emptyText:empTxt,
				id : 'nickName',
				name : 'nickName',
				labelSeparator:'',
				labelAlign : 'right',
				margin:'10 15 0 10',
				name : 'searchTextBox',
				enableKeyEvents: true,
				value: jsonData.pageParams.searchnickname,
				listeners:{
					render: function (field) {
						  field.focus(); 
					},
				},
					onTriggerClick: function() {
					if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1){
						Ext.getCmp('perPanel').compSubmitButtonClicked('','','',fromMetricView);
					}else{
						var fromPageView=jsonData.pageParams.fromPageView;
						var userName=jsonData.pageParams.userName;
						var selectedStateVal=jsonData.pageParams.selectedState;
						
						Ext.getCmp('perPanel').compSubmitButtonClicked(fromPageView,userName,selectedStateVal,fromMetricView);
					}
				}
			};
			var fromPageView=jsonData.pageParams.fromPageView;
			var hideComboandSearch=false;
			if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
				hideComboandSearch=true;

			var addContainer=Ext.create('Ext.container.Container',{
				xtype:'container',
				//layout:'vbox',
				//layout:'fit',
				//html:'12121',
				flex:1,
				layout:{
					type:'vbox',
					align:'stretch'
				},
				items:[/*{
					xtype:'panel',
					layout:{type:'hbox',pack:'left'},
					padding:10,
					height:70,
					id:'logonFormPanel',
					cls:'formOuter',
					items:toolbarConfig,
					hidden:hideComboandSearch
				},*/{
					xtype:'panel',
					//cls:'dataPanel',
					autoScroll:false,
					scroll:false,
					flex:1,
					layout:{
						type:'vbox',
						align:'stretch'
					},
					id:'gridContainer'
				}]
			});

			//if(gridStore.getCount()>0)
			if(gridStore!=null)
			{
				var gridPanel = this.down('generalMeasuresGrid');

				/*if(!Ext.isEmpty(gridPanel) && gridPanel!=null)
				{
					gridPanel.reconfigure(gridStore, columns);
					return;
				}*/

				if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') > -1)
				{
					gridPanel.getStore().loadRawData(jsonData);
				}
				else
				{
					this.add(addContainer);

					var systemGrid=null;
					if(gridStore.getCount()==0)
					{
						var emptyTextVal='';

						if(empTxt == 'Simulations')
							emptyTextVal='No current data for simulations';
						else
							emptyTextVal='No '+empTxt+' Found';
						if(this.itemId!=null && (!Ext.isEmpty(simulationSupportList) && ( simulationSupportList.indexOf(this.itemId) != -1 || this.itemId == "ExtTestDashboard")) && (jsonData.error!=null || jsonData.error!=undefined || jsonData.error!="" || jsonData.error!="undefined"))
						{
							emptyTextVal=jsonData.error;
						}
						
						systemGrid=Ext.create('Ext.panel.Panel',{
							//cls:'gridSkin gridSkin_locking',
							ui:'newGridPanel',
							margin:10,
							frame:false,
							//style:{'border':'0px !important'},
							border:false,
							layout:{type:'vbox',pack:'center'}, // iconExclamation center
							flex:1,
							items: [{
									xtype: 'container',
									width:'100%',
									//padding: 50,
									style: {
									'text-align': 'center'
									},
									html: '<div class = "iconInformation" style="margin:0% auto 0px auto"></div><div>'+emptyTextVal+'</div>'
								}
							],
							isFormHide:hideComboandSearch,
							/*listeners:{
								'afterrender':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								},
								'resize':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								}
							}*/
						});
					}
					else
					{
						var gridCls="";
						var isLock=false;
						if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
						{
							//gridCls="iconGrid";
							gridCls="newGridPanel removeTableBg";
							isLock=false;
						}
						else
						{
							//gridCls="gridSkin gridSkin_locking";
							gridCls="newGridPanel removeTableBg";
							isLock=true;
						}
						var margin = 8;
						/* This view is called in Comparsion app 
						* isLogonFromService is boolean variable 
						* to set margin in user Exp tab 
						*/
						
						if(!Ext.isDefined(window.isLogonFromService)){
							margin = 6;
						}
						systemGrid=Ext.create('GeneralMeasuresGrid',{
							plugins:Ext.create('Ext.ux.AutoColumnWithLockingPlugin'),
							itemId:'generalMeasuresGrid',
							columns:columns,
							ui:gridCls,
							margin:margin,
							refId:this.itemId,
							bodyCls:'newGridPanelBorder',
							//style:{'border-width':'0px 1px 1px 1px !important'},
							layout:'fit',
							border:true,
							enableLocking:isLock,
							flex:1,
							store:gridStore,
							viewConfig: {
								emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>'
							},
							listeners:{
								'columnresize':function( ct, column, width, eOpts )
								{
									try
									{
										var tempColumnDataIndex= (Ext.decode(Ext.util.Cookies.get('tempColumnDataIndex')));
										var tempColumnObj= (Ext.decode(Ext.util.Cookies.get('tempColumnObj')));
										var checkDuplicates = new Set(tempColumnObj);
										if(checkDuplicates.size != tempColumnObj.length)
										{
											Ext.util.Cookies.clear('tempColumnObj');
											Ext.util.Cookies.clear('tempColumnDataIndex');
											tempColumnDataIndex = [];
											tempColumnObj = [];
										}
										if(tempColumnDataIndex == undefined || tempColumnDataIndex == null)
											tempColumnDataIndex = [];
										if(tempColumnObj == undefined || tempColumnObj == null)
											tempColumnObj = [];										
									}
									catch (er)
									{
										var tempColumnDataIndex=[];
										var tempColumnObj=[];

									}
									if(tempColumnDataIndex.indexOf(column.dataIndex) != -1)
									{
										var indexVal = [];
										for (var c=0; c<tempColumnDataIndex.length; c++) 
										{
											if(tempColumnDataIndex[c] == column.dataIndex) 
											{
												indexVal.push(c);
											}
										}
										try
										{	
											if(indexVal.length == 1)
											{
												if(tempColumnObj[indexVal[0]].compType == compType)
												{
													tempColumnDataIndex.splice(indexVal[0], 1);
													tempColumnObj.splice(indexVal[0], 1);
												}
											}
											else
											{
												for(var r=0;r<indexVal.length-1;r++){
													if(tempColumnObj[indexVal[r]].compType == compType)
													{
														tempColumnDataIndex.splice(indexVal[r], 1);
														tempColumnObj.splice(indexVal[r], 1);
													}
												}
											}
										}
										catch(er)
										{											
										}
										tempColumnDataIndex.push(column.dataIndex);
										tempColumnObj.push({
											"dataIndex":column.dataIndex,
											"measureOrgName":column.measureOrgName,
											"dashboardName":dashboardName,
											"compType":compType,
											"width":width
										});										
									}
									else
									{
										tempColumnDataIndex.push(column.dataIndex);
										tempColumnObj.push({
											"dataIndex":column.dataIndex,
											"measureOrgName":column.measureOrgName,
											"dashboardName":dashboardName,
											"compType":compType,
											"width":width
										});
									}
									try
									{									
										if(colAddDel != null && colAddDel.trim().length > 0)
										{
											for(var t=0;t<tempColumnObj.length;t++)
											{
												if(tempColumnObj[t].compType.startsWith(colAddDel))
												{
													tempColumnDataIndex.splice(t,1);
													tempColumnObj.splice(t,1);
													t--;
												}
											}
										}
									}
									catch (e)
									{
									}
									Ext.util.Cookies.set('tempColumnObj',Ext.encode(tempColumnObj));
									Ext.util.Cookies.set('tempColumnDataIndex',Ext.encode(tempColumnDataIndex));

									if(document.cookie.length > 131072)
									{
										Ext.util.Cookies.clear('tempColumnObj');
										Ext.util.Cookies.clear('tempColumnDataIndex');
									}
								},
								'resize': function(e){
									Ext.defer(function()
									{
										//var itemsArray=jsonData;										
										var itemsArray=e.getStore().data.items;										
										//for(var item=0; item< itemsArray.measures.length ; item++)
										for(var item=0; item< itemsArray.length ; item++)
										{
											var itemJson=itemsArray[item].data;
											var keys = [];
											for(var k in itemJson) 
												keys.push(k);
											for(var i=0;i<keys.length;i++)
											{
												var tempKey = keys[i];
												if(tempKey.indexOf("Graph")>-1)
												{
													var graphData = itemJson[tempKey];
													if ( !Ext.isEmpty(graphData) && graphData != '-' )
													{
														var returnDAta = getAreaCharts("ClientEmulation_"+tempKey+"_"+item,'80','16',graphData,"sparkPath"+item);
														try
														{	
															$("#ClientEmulation_"+tempKey+"_"+item).highcharts(returnDAta);	
														}
														catch (e)
														{
															//console.log("e=-=-=-=--=>>",e)
														}														
													}
												}
												else
													continue;
											}
										}
										
									},200);									
								}
							},
							dockedItems: [{
								hidden:jsonData.countJson['isHidePaging'],
								xtype: 'pagingtoolbar',
								id:'pagingtoolbarCustom',
								style:{'border-top':'none !important'},
								store: gridStore,   // same store GridPanel is using
								dock: 'bottom',
								//cls:'pagingtoolbar',
								cls:'newPagination',
								//..afterTextItem:2,
								afterPageText:'of '+ totalPageNo,
								displayInfo: true,
								displayMsg: disptxt+' '+ gridMsg,
								moveFirst:function()
								{
									if(OrgItemId=='system' || OrgItemId=='System')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
										}
									}
									
									else if(OrgItemId=='components' || OrgItemId=='Components')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
										}
									}
									else
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo=1";
											Refurl=glUrl;
										}
									}
									if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
										Ext.getCmp('perPanel').returnPaginationData('1',fromMetricView);
									else
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo,fromMetricView);
									RefpageVal='1';
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
								},
								movePrevious:function()
								{
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
										return;
									else
									{
										pageVal = pageVal - 1;
										
										if(OrgItemId=='system' || OrgItemId=='System')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										
										else if(OrgItemId=='components' || OrgItemId=='Components')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										RefpageVal=pageVal;
										Reftot=totalRecords;
										ReftotalPageno=totalPageNo;
										if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
											Ext.getCmp('perPanel').returnPaginationData(pageVal,fromMetricView);
										else
											Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
									}

									/*if(prevArray.length > 2)
									{
										pageCount = prevArray[prevArray.length-2];
										var a = new Array();
										for(var i=0;i<prevArray.length-2;i++)
											a.push(prevArray[i]);
										
										prevArray = new Array();
										prevArray = a;
									}
									else
										pageCount =1;

									if(currentPage > 1)
									{
										pageNoMain=currentPage-1;
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(currentPage-1,"fromPagination",totalPage);
									}
									else
									{
										pageNoMain=1;
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(1,"fromPagination",totalPage);
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
									}*/
								},
								moveNext : function()
								{
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									
									if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
										return;
									else if(pageVal==totalPageNo)
									{
										Ext.Msg.alert('alert','No More Pages');
										return;
									}
									else
									{
										pageVal = pageVal + 1;
										if(OrgItemId=='system' || OrgItemId=='System')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else if(OrgItemId=='components' || OrgItemId=='Components')
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										else
										{
											if(glUrl.indexOf("pageNo") > -1)
											{
												glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
												Refurl=glUrl;
											}
											else
											{
												glUrl=glUrl+"&pageNo="+pageVal;
												Refurl=glUrl;
											}
										}
										if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
											Ext.getCmp('perPanel').returnPaginationData(pageVal,fromMetricView);
										else
											Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
									}
									RefpageVal=pageVal;
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
									//pageNoMain=pageNoMain+1;
									//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(currentPage+1,"fromPagination",totalPage);
									//Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
								},
								moveLast : function()
								{
									//pageNoMain = totalPage;
									//if(!seqHideFlag)
										//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(totalPage,"fromPagination",totalPage);
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									if(pageVal==totalPageNo)
									{
										Ext.Msg.alert('alert','No More Pages');
										return;
									}
									
									if(OrgItemId=='system' || OrgItemId=='System')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
										}
									}
									
									else if(OrgItemId=='components' || OrgItemId=='Components')
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
										}
									}
									else
									{
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+totalPageNo;
											Refurl=glUrl;
										}
									}
									if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
										Ext.getCmp('perPanel').returnPaginationData(totalPageNo,fromMetricView);
									else
										Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,totalPageNo,totalPageNo,fromMetricView);
									
									RefpageVal=totalPageNo;
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
									/*else
									{
										Ext.Msg.alert('Status','Direct Page Movement Not Applicable for this Test');
										return;
									}*/
								},
								/*doRefresh:function(){
									pageNoMain=1;
									//PerformanceDashboard.app.getController("Main").showDetailedDiagnosis(1,"fromPagination",totalPage);
									Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,'1',totalPageNo);
								},*/
								onPagingKeyDown:function(field, e)
								{
									var me = this,
									k = e.getKey();
									if (k == e.RETURN) 
									{
										var pageVal = Ext.getCmp('afterTextColumn').getValue();
										if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
											return;
										else if(pageVal > totalPageNo)
										{
											Ext.Msg.alert('alert','No More Pages');
											return;
										}
										else
										{
											RefpageVal=pageVal;
											Reftot=totalRecords;
											ReftotalPageno=totalPageNo;
											
											if(OrgItemId=='system' || OrgItemId=='System')
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
												}
											}
											
											else if(OrgItemId=='components' || OrgItemId=='Components')
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
												}
											}
											else
											{
												if(glUrl.indexOf("pageNo") > -1)
												{
													glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
													Refurl=glUrl;
												}
												else
												{
													glUrl=glUrl+"&pageNo="+pageVal;
													Refurl=glUrl;
												}
											}
											
											if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
												Ext.getCmp('perPanel').returnPaginationData(pageVal,fromMetricView);
											else
												Ext.getCmp('perPanel').loadTab(glUrl,totalRecords,pageVal,totalPageNo,fromMetricView);
										}
									}
								},
								emptyMsg: "No topics to display"
							}],
							//tbar:toolbarConfig,
							frame:false,
							emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>',
							isFormHide:hideComboandSearch,
							/*listeners:{
								'afterrender':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								},
								'resize':function(panel){
									var panelH=0;
									if(panel.isFormHide)
									{
										panelH=Ext.getBody().getViewSize().height-70;
									}
									else
									{
										panelH=Ext.getBody().getViewSize().height-150;
									}
									panel.setHeight(panelH);
								}
							}*/
							//cls:'systemsGrid'
						});
					}

					var monitorComboWidth = 250;
					if( jsonData.monitorComboWidth != undefined && jsonData.monitorComboWidth != 'undefined' && jsonData.monitorComboWidth != null)
						monitorComboWidth = jsonData.monitorComboWidth;

					var fromPageView=jsonData.pageParams.fromPageView;
					var hideComboandSearch=true;
					//if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
						//hideComboandSearch=false;
					if(Ext.isEmpty(this.searchBoxCombo) || this.searchBoxCombo){
						if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
						{
							var agentSelectredVal;
							var len = 0;
							try
							{
								len= jsonData.externalAgentObj.externalAgentArr.length;
							}
							catch (e)
							{
							}
								
							if(jsonData.externalAgentObj.selectedextAgentType != undefined)
								agentSelectredVal=jsonData.externalAgentObj.selectedextAgentType;
							else if(len  > 2 )
								agentSelectredVal='all';
							else 
								agentSelectredVal='Not Applicable';

							var extAgentStore = Ext.create('Ext.data.Store',{
								fields:['name','value'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										root:'externalAgentArr'
									}
								},
								data:jsonData.externalAgentObj
							});
							var extAgentCombo={
								xtype:'combo',
								id:'extAgent',
								labelAlign : 'left',
								editable : false,
								store:extAgentStore,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'name',
								valueField: 'value',
								trigerAction:'all',
								fieldLabel:extagent+':',
							
								labelWidth:95,
								queryMode: 'local',
								margin:'10 0 0 10',
							
								//value:'filterByCombo'
								//value:'Chennai'
								value:agentSelectredVal,
								listeners:{
									'change':function(){
										RefSortByLogon = undefined;
										RefSortByLogonType = undefined;
										RefSortByLogonId = undefined;
									}
								}
							};
							
							var testSelectredVal;
							var len = 0;
							try
							{
								len= jsonData.externalAgentObj.externalAgentArr.length;
							}
							catch (e)
							{
							}
								
							if(jsonData.externalTestObj.selectedExtTest != undefined)
								testSelectredVal=jsonData.externalTestObj.selectedExtTest;
							else if(len  > 2 )
								testSelectredVal='all';
							else 
								testSelectredVal='Not Applicable';
							var extTestStore = Ext.create('Ext.data.Store',{
								fields:['name','value','url'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										root:'externalTestArr'
									}
								},
								data:jsonData.externalTestObj
							});
							var extTestCombo={
								xtype:'combo',
								id:'extTest',
								labelAlign : 'left',
								editable : false,
								store:extTestStore,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'name',
								valueField: 'value',
								trigerAction:'all',
								fieldLabel:simulations+':',
								labelWidth:75,
								width:monitorComboWidth,
								queryMode: 'local',
								margin:'10 0 0 10',
								value:testSelectredVal,
								listeners:{
									'change':function(){
										RefSortByLogon = undefined;
										RefSortByLogonType = undefined;
										RefSortByLogonId = undefined;
									}
								}
							};

							if(hideComboandSearch && (fromServiceDashboard == 'false' || fromServiceDashboard == false))
							{
								systemGrid.addDocked({
									xtype: 'toolbar',
									padding:'5 0 5 0',
									//dock: 'top',
									layout:'hbox',
									ui:'topToolbarBorder',
									//cls:'formOuter',
									//style:{'background-color':'transparent'},
									items: [extTestCombo,extAgentCombo,'->',nickName]
								});
							}
							//Ext.getCmp("logonFormPanel").setVisible(false);
							if(!Ext.isEmpty(Ext.getCmp("logonFormPanel"))){
								Ext.getCmp("logonFormPanel").setVisible(false);
							}
						}
						else if(!Ext.isEmpty(this.itemId) && this.itemId == 'ExtTestDashboard')
						{
							var agentSelectredVal;
							var len = 0;
							try
							{
								len= jsonData.externalAgentObj.externalAgentArr.length;
							}
							catch (e)
							{
							}
							if(jsonData.externalAgentObj.selectedextAgentType != undefined)
								agentSelectredVal=jsonData.externalAgentObj.selectedextAgentType;
							else if(len  > 2 )
								agentSelectredVal='All';
							else 
								agentSelectredVal='Not Applicable';

							var extAgentStore = Ext.create('Ext.data.Store',{
								fields:['name','value'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										root:'externalAgentArr'
									}
								},
								data:jsonData.externalAgentObj
							});
							var extAgentCombo={
								xtype:'combo',
								id:'extAgent',
								labelAlign : 'left',
								editable : false,
								store:extAgentStore,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'name',
								valueField: 'value',
								trigerAction:'all',
								fieldLabel:extagent+':',
							
								labelWidth:95,
								queryMode: 'local',
								
								margin:'10 0 0 10',
								//value:'filterByCombo'
								//value:'Chennai'
								value:agentSelectredVal,
								listeners:{
									'change':function(){
										RefSortByLogon = undefined;
										RefSortByLogonType = undefined;
										RefSortByLogonId = undefined;
									}
								}
							};

							var testSelectredVal;
							var len = 0;
							try
							{
								len= jsonData.externalAgentObj.externalAgentArr.length;
							}
							catch (e)
							{
							}
								
							if(jsonData.externalTestObj.selectedExtTest != undefined)
								testSelectredVal=jsonData.externalTestObj.selectedExtTest;
							else if(len  > 2 )
								testSelectredVal='all';
							else 
								testSelectredVal='Not Applicable';
							var extTestStore = Ext.create('Ext.data.Store',{
								fields:['name','value','url'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										root:'externalTestArr'
									}
								},
								data:jsonData.externalTestObj
							});
							var extTestCombo={
								xtype:'combo',
								id:'extTest',
								labelAlign : 'left',
								editable : false,
								store:extTestStore,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'name',
								valueField: 'value',
								trigerAction:'all',
								fieldLabel:simulations+':',
								width:monitorComboWidth,
								labelWidth:75,
								queryMode: 'local',
								margin:'10 0 0 10',
								value:testSelectredVal,
								listeners:{
									'change':function(){
										RefSortByLogon = undefined;
										RefSortByLogonType = undefined;
										RefSortByLogonId = undefined;
									}
								}
							};
							if(hideComboandSearch)
							{
								systemGrid.addDocked({
									xtype: 'toolbar',
									padding:'5 0 5 0',
									ui:'topToolbarBorder',
									//dock: 'top',
									layout:'hbox',
									//cls:'formOuter',
									//style:{'background-color':'transparent'},
									items: [extTestCombo,extAgentCombo,'->',nickName]
								});
							}
							if(!Ext.isEmpty(Ext.getCmp("logonFormPanel"))){
								Ext.getCmp("logonFormPanel").setVisible(false);
							}
						}
						else
						{
							var hiddenCombo=false;
							var hiddenSubCombo=true;
							if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
							{
								hiddenCombo=true;
								if(!jsonData.pageParams.isSubFilterOption)
									hiddenSubCombo=true;
							}
							else
							{
								if(jsonData.pageParams.isSubFilterOption)
									hiddenSubCombo=true;
								else
									hiddenSubCombo=false;
							}
							
							var filterByCombo=null;

							var filterByComboStore = Ext.create('Ext.data.Store',{
								fields:['displayField','valueField'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										//root:'SortbytypeKey'
									}
								},
								data:jsonData.filterByOptions
							});
							filterByCombo={
								xtype:'combo',
								id:'filterByCombo',
								labelAlign : 'right',
								editable : false,
								store:filterByComboStore,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'displayField',
								valueField: 'valueField',
								trigerAction:'all',
								fieldLabel:filterByLabel,
								labelStyle:'padding-right:6px !important',
								labelWidth:60,
								queryMode: 'local',
								margin:'0 0 0 8',
								hidden:hiddenCombo,
								//value:'filterByCombo'
								//value:jsonData.sortByMainOptions.SortbytypeKey.name
								value:jsonData.pageParams.selectedFilterByOption
							};
							
							var subFilterCombo=null;
							var subFilterComboStroe = Ext.create('Ext.data.Store',{
								fields:['displayField','valueField'],
								proxy:{
									type: 'memory',
									reader: {
										type: 'json',
										//root:'SortbytypeKey'
									}
								},
								data:jsonData.subFilterOptions
							});
							subFilterCombo={
								xtype:'combo',
								id:'subFilterCombo',
								labelAlign : 'right',
								editable : false,
								labelStyle:{'padding-right':'20px !important'},
								store:subFilterComboStroe,
								labelSeparator:'',
								cls : 'dropdown',
								displayField: 'displayField',
								valueField: 'valueField',
								labelStyle:'padding-right:6px !important',
								trigerAction:'all',
								fieldLabel:jsonData.pageParams.subFilterLabel,
								labelWidth:70,
								//margin:'0 0 0 60',
								margin:'0 0 0 8',
								queryMode:'local',
								hidden: hiddenSubCombo,
								//value:'subFilterCombo'
								//value:jsonData.sortByMainOptions.SortbytypeKey.name
								value:jsonData.pageParams.selectedSubFilterOption
							};

							var componentTypCombo=null;
							if(!Ext.isEmpty(jsonData.componentTypeOptions))
							{
								var componentTypStore = Ext.create('Ext.data.Store',{
									fields:['value','name'],
									proxy:{
										type: 'memory',
										reader: {
											type: 'json',
											root:'selectOptions'
										}
									},
									data:jsonData.componentTypeOptions
								});
								componentTypCombo={
									xtype:'combo',
									id:'componentTypCombo',
									labelAlign : 'right',
									editable : false,
									store:componentTypStore,
									labelSeparator:'',
									cls : 'dropdown',
									labelStyle:'padding-right:6px !important',
									//margin:'0 0 0 60',
									margin:'0 0 0 8',
									width:300,
									displayField:'name',
									valueField:'value',
									trigerAction:'all',
									queryMode: 'local',
									fieldLabel:jsonData.componentTypeOptions.componentTypeLabel,
									labelWidth:110,
									hidden:hiddenCombo,
									value:jsonData.componentTypeOptions.selectedComponentType
								};
							}
							
							var sortByCombo=null;
							if(!Ext.isEmpty(jsonData.sortByMainOptions))
							{
								var sortByComboStore = Ext.create('Ext.data.Store',{
									fields:['value','name'],
									proxy:{
										type: 'memory',
										reader: {
											type: 'json',
											//root:'SortbytypeKey'
										}
									},
									data:jsonData.sortByMainOptions.sortByOptions
								});
								sortByCombo={
									xtype:'combo',
									id:'sortByCombo',
									labelAlign : 'right',
									editable : false,
									hidden: true,
									//margin:'0 0 0 60',
									margin:'0 0 0 8',
									store:sortByComboStore,
									labelSeparator:'',
									cls : 'dropdown',
									displayField:'name',
									valueField:'value',
									trigerAction:'all',
									queryMode: 'local',
									fieldLabel:jsonData.sortByMainOptions.sortByLabel,
									labelWidth:70,
									value:jsonData.sortByMainOptions.sortBySelectedMeasure
									//value:jsonData.sortByMainOptions.SortbytypeKey.name
									//value:'Please Select Options'
								};
							}

							if(hideComboandSearch)
							{
								systemGrid.addDocked({
									xtype: 'toolbar',
									padding:'5 0 5 0',
									dock: 'top',
									layout:'hbox',
									ui:'topToolbarBorder',
									//cls:'formOuter',
									//style:{'background-color':'transparent'},
									//items: [nickName],
									items:[filterByCombo,subFilterCombo,componentTypCombo,sortByCombo,'->',nickName]
								});
							}
						}
					}
					
					//this.add(addContainer);
					Ext.getCmp("gridContainer").add(systemGrid);
					Ext.getCmp("gridContainer").doComponentLayout();
					
				}
			}
			else
			{
				var dockedItems = me.getDockedItems('toolbar');
				for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
					me.removeDocked(dockedItems[dockedCounter]);
				}

				var error_msg=jsonData.screenLabels[this.screenLabelPath+'.noDataMsg'];
				var error_panel={
						xtype:'emptypanel',
						//tbar:toolbarConfig,
						//style:{'border':'0px !important'},
						border:false,
						frame:false,
						layout:'fit',
						flex:1,
						bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						cls:'egDummyClass',
						items: [{
								xtype: 'container',
								//padding: 50,
								style: {
									'text-align': 'center'
								},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
								}
						]

					//	xtype:'errorpanel',
					//	errorMsg:error_msg,
					//	tbar:toolbarConfig
				};

				var fromPageView=jsonData.pageParams.fromPageView;
				var hideComboandSearch=true;
				if(fromPageView!=null && (fromPageView=='Zone' || fromPageView=='ZoneMap' || fromPageView=='HomeZone' || fromPageView=='Home'))
					hideComboandSearch=false;
				if(hideComboandSearch)
				{
					error_panel.addDocked({
						xtype: 'toolbar',
						dock: 'top',
						cls:'linebottom toolbarBg',
						//bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						//style:{'background-color':'transparent !important','background-image':'none !important'},
						padding:'1 10 1 2',
						items: toolbarConfig
					});
				}
				this.add(error_panel);
			}
			
			if(!Ext.isEmpty(simulationSupportList) && simulationSupportList.indexOf(this.itemId) != -1)
				this.sortIconDispOperation(RefSortByLogonId);
		}
	},
	sortByMeasureValues: function(orderByColumn,orderBy,columnDispName,fromMetricView){
		
		var url = '/final/monitor/endUserDashboardData.jsp?user='+userName;
		var searchString = Ext.getCmp("searchString")!=null?Ext.getCmp("searchString").value:"";
		var adtnlSearchStr = Ext.getCmp("adtnlSearchString")!=null?Ext.getCmp("adtnlSearchString").value:"";
		var limit = Ext.getCmp("limitCombo")!=null?Ext.getCmp("limitCombo").value:'';
		var vdiType = Ext.getCmp("vdiTypeCombo")!=null?Ext.getCmp("vdiTypeCombo").value:'';

		var newUserType=userType;
		try{
			var typeCombobox = Ext.getCmp("vdiTypeCombo");
			if(!Ext.isEmpty(typeCombobox) && !Ext.isEmpty(typeCombobox.getValue()) && typeCombobox.getValue()!="")
			{
				var v = typeCombobox.getValue();
				var vdi_record = typeCombobox.findRecord(typeCombobox.valueField || typeCombobox.displayField, v);
				var vdi_index = typeCombobox.store.indexOf(vdi_record);

				newUserType=typeCombobox.getStore().getAt(vdi_index).get('usertype');
				if(Ext.isEmpty(newUserType))
					newUserType=userType;
			}
		}catch(e){

		}

		try
		{
			if(fromctx!=null && fromctx!='null' && fromctx!='' && fromctx!='undefined')
			{
				if(defaultDispLimit!=null && defaultDispLimit!=undefined && defaultDispLimit!="")
					limit = defaultDispLimit;
				if(defaultVdiType!=null && defaultVdiType!=undefined && defaultVdiType!="")
					vdiType = defaultVdiType;
			}
		}
		catch (ee)
		{
		}
		
		url = url+"&orderByColumn="+orderByColumn+"&orderBy="+orderBy;
		url = url + "&userType="+newUserType;
		if(!Ext.isEmpty(searchString) && searchString != null && searchString != 'null' && searchString != undefined)
		  {
  			try
  			{
  				url = url + "&searchString="+encodeURIComponent(parent.filterEncode(searchString));
  			}
  			catch (e)
  			{
  				url = url + "&searchString="+encodeURIComponent(parent.parent.filterEncode(searchString));
  			}
		  }
		if(!Ext.isEmpty(adtnlSearchStr) && adtnlSearchStr!=null && adtnlSearchStr!='null' && adtnlSearchStr!='' && adtnlSearchStr!='undefined')
			url = url + "&adtnlSearchStr="+adtnlSearchStr;
		if(limit!=null && limit!='null' && limit!='' && limit!='undefined')
			url = url + "&priority="+limit;
		if(vdiType!=null && vdiType!='null' && vdiType!='' && vdiType!='undefined' && vdiType!='VDI' && vdiType!='ESX' && vdiType!='Terminal' && vdiType!='Horizon'){
			url = url + "&vdiType="+vdiType;
		}
		if(columnDispName!=null && columnDispName!='null' && columnDispName!='' && columnDispName!='undefined'){
			url = url + "&columnDispName="+columnDispName;
			currColumndispName = columnDispName;
		}
		
		if(fromctx!=null && fromctx!='null' && fromctx!='' && fromctx!='undefined')
			url = url + "&fromctx="+fromctx;

		if(isFromMenu)
		{
			url = url + "&fromMenu=true";
		}
		if(filterParam!=null && filterParam!='null' && filterParam!='' && filterParam!=undefined)
		{
		  var temphqstringUrl="";
			if(!Ext.isEmpty(filterParam) && filterParam!=null && filterParam!='null' && filterParam!=undefined)
			{	
				if(filterParam.indexOf('&') == 0)
					filterParam=filterParam.substring(1);
				var filterParamSplit = filterParam.split('&');
				var agr="";
				for(i=0; i<filterParamSplit.length;i++)
				{
					if(!Ext.isEmpty(filterParamSplit[i]) && filterParamSplit[i]!= null)
					{
						agr=filterParamSplit[i].split('=');
						if(!Ext.isEmpty(agr[0]) && agr[0] != null)
						{
							if(agr[0] == "dsInfo")
								agr[1] = encodeURIComponent(agr[1]);
						}
						temphqstringUrl+="&"+agr[0]+"="+agr[1];
					}
				}
			  url += temphqstringUrl;
			}
		}

		var groupCom = Ext.getCmp('groupCombo');
		var groupAd = Ext.getCmp('adgroup');
		if(groupCom != undefined && groupCom != null && groupAd != undefined && groupAd != null){
			var grVal = groupCom.getValue();
			if(grVal=='ad_group'){
				var grAdVal = groupAd.getValue();
				if(grAdVal != null & grAdVal != undefined )
					grAdVal = grAdVal.replace(/=/g, "|eq|");
				url =url+'&aduserFilter='+grAdVal;
			}
		}

		if(isFromGeo)
		{
			url = url + "&fromGeo=true&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+dashboard_mapping+"&time_line="+time_line+"&ginfo="+geoInfo+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+selectedMeasure;
		}


		var myMaskID=this.id;
		if (!Ext.isEmpty(myMaskID))
		{
			var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
			//myMask.show();
		}
		if(fromMetricView!=null && fromMetricView!='null' && fromMetricView!='' && fromMetricView!='undefined')
			url = url + "&fromMetricView="+fromMetricView;
		if(!Ext.isEmpty(enableBackButton) && enableBackButton != null && enableBackButton == "true")
			url+="&enableBackButton=true";
		Refurl=url;
		userUrl = url;
		//Ext.getCmp('perPanel').
		Ext.getCmp('perPanel').loadTab(url,'','','',fromMetricView);
	},
	sortByDDMeasureValues: function(orderByColumn,orderBy,columnDispName,measureUnit,fromMetricView){
		var url = '/final/monitor/endUserDashboardData.jsp?user='+userName;
		var searchString = Ext.getCmp("searchString")!=null?Ext.getCmp("searchString").value:"";
		var adtnlSearchStr = Ext.getCmp("adtnlSearchString")!=null?Ext.getCmp("adtnlSearchString").value:"";
		var limit = Ext.getCmp("limitCombo")!=null?Ext.getCmp("limitCombo").value:'';
		var vdiType = Ext.getCmp("vdiTypeCombo")!=null?Ext.getCmp("vdiTypeCombo").value:'';

		var newUserType=userType;
		try{
			var typeCombobox = Ext.getCmp("vdiTypeCombo");
			if(!Ext.isEmpty(typeCombobox) && !Ext.isEmpty(typeCombobox.getValue()) && typeCombobox.getValue()!="")
			{
				var v = typeCombobox.getValue();
				var vdi_record = typeCombobox.findRecord(typeCombobox.valueField || typeCombobox.displayField, v);
				var vdi_index = typeCombobox.store.indexOf(vdi_record);

				newUserType=typeCombobox.getStore().getAt(vdi_index).get('usertype');
				if(Ext.isEmpty(newUserType))
					newUserType=userType;
			}
		}catch(e){

		}
		
		try
		{
			if(fromctx!=null && fromctx!='null' && fromctx!='' && fromctx!='undefined')
			{
				if(defaultDispLimit!=null && defaultDispLimit!=undefined && defaultDispLimit!="")
					limit = defaultDispLimit;
				if(defaultVdiType!=null && defaultVdiType!=undefined && defaultVdiType!="")
					vdiType = defaultVdiType;
			}
		}
		catch (ee)
		{
		}

		url = url+"&orderByColumn="+orderByColumn+"&orderBy="+orderBy;
		url = url + "&userType="+newUserType;
		if(searchString!=null && searchString!='null' && searchString!='' && searchString!='undefined')
			url = url + "&searchString="+searchString;
		if(!Ext.isEmpty(adtnlSearchStr) && adtnlSearchStr!=null && adtnlSearchStr!='null' && adtnlSearchStr!='' && adtnlSearchStr!='undefined')
			url = url + "&adtnlSearchStr="+adtnlSearchStr;
		if(limit!=null && limit!='null' && limit!='' && limit!='undefined')
			url = url + "&priority="+limit;
		if(vdiType!=null && vdiType!='null' && vdiType!='' && vdiType!='undefined' && vdiType!='VDI' && vdiType!='ESX' && vdiType!='Terminal' && vdiType!='Horizon'){
			url = url + "&vdiType="+vdiType;
		}
		
		if(columnDispName!=null && columnDispName!='null' && columnDispName!='' && columnDispName!='undefined'){
			url = url + "&columnDispName="+columnDispName;
			currColumndispName = columnDispName;
		}
		if(measureUnit!=null && measureUnit!='null' && measureUnit!='' && measureUnit!='undefined'){
			url = url + "&columnType="+measureUnit;
			currColumnType = measureUnit;
		}
		if(isFromMenu)
		{
			url = url + "&fromMenu=true";
		}

		if(isFromGeo)
		{
			url = url + "&fromGeo=true&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+dashboard_mapping+"&time_line="+time_line+"&ginfo="+geoInfo+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+selectedMeasure;
		}
		
		if(fromctx!=null && fromctx!='null' && fromctx!='' && fromctx!='undefined')
			url = url + "&fromctx="+fromctx;

		var groupCom = Ext.getCmp('groupCombo');
		var groupAd = Ext.getCmp('adgroup');
		if(groupCom != undefined && groupCom != null && groupAd != undefined && groupAd != null){
			var grVal = groupCom.getValue();
			if(grVal=='ad_group'){
				var grAdVal = groupAd.getValue();
				if(grAdVal != null & grAdVal != undefined )
					grAdVal = grAdVal.replace(/=/g, "|eq|");
				url =url+'&aduserFilter='+grAdVal;
			}

			if(endUserOverviewFlag)
			{
				url = url + '&endUserDashOverview='+endUserOverviewFlag;
			}
		}

		if(filterParam!=null && filterParam!='null' && filterParam!='' && filterParam!=undefined)
		{
			if(filterParam.indexOf('&') == 0)
             		  url = url + filterParam ;
			else
			 url = url +"&"+filterParam;
		}

		if(endUserOverviewFlag)
		{	
			url = url + '&isfromuedsort='+isfromuedsort;
		}
		if(fromMetricView!=null && fromMetricView!='null' && fromMetricView!='' && fromMetricView!='undefined')
			url = url + "&fromMetricView="+fromMetricView;
		var myMaskID=this.id;
		if (!Ext.isEmpty(myMaskID))
		{
			var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
			myMask.show();
		}
		
		userUrl = url;
		Refurl=url;
		Ext.getCmp('perPanel').loadTab(url,'','','',fromMetricView);
		myMask.hide();
	},
	loadVDTab:function(url,totalRecords,pageNo,totalPageNo,itemType,combo,isCombo){
		
		var me = this;
		var myMask = null;
		if(!Ext.isEmpty(me))
		{
			myMask = new Ext.LoadMask(me, {msg:"Please wait..."});
			myMask.show();
		}
		var tem_url = url;
		if(isCombo && combo != undefined && combo != "undefined" && combo.getValue() !=undefined && combo.getValue() != "undefined")
		{
			//var tem_url = url;
			if(tem_url != undefined && tem_url != 'undefined' && tem_url != "" && tem_url != null)
			{
				if(tem_url.indexOf("comboValue=") > -1)
				{
					if(tem_url.indexOf("comboValue=") > -1)
					{
						tem_url=tem_url.replace(/(comboValue=).*?(&)/,'$1' + combo.getValue() + '$2');
					}
				}
				else
				{
					var urlData = tem_url.split("?");
					var secUrl = urlData[0]+"?"+"comboValue="+combo.getValue()+"&"+urlData[1]
					tem_url = secUrl;
				}
			}
		}

		url=tem_url;
		glUrl=url;

		if(pageNo == null || pageNo == undefined || pageNo =='')
			pageNo='1';

		urlForRefresh=glUrl;
		if(pageNo=='1')
		{
			Ext.Ajax.request({
			url : url,
			scope:this,
			timeout:280000,
			success: function(response)
			{
				var jsonText = response.responseText;
				var jsonData = Ext.decode(jsonText);
				var jsonDataArr = jsonData;
				var totalRecords = null;
				var totalPageNo = null;
				var pagesize = null;
				var isJsonData = false;
				myMask.hide();
				if(!Ext.isEmpty(jsonData) && !isCombo)
				{
					isJsonData = true;
					myMask.hide();
					this.entireData = jsonData;
					this.entireOrgData = jsonData;
					totalRecords = jsonData.countJson['recount'];
					totalPageNo = jsonData.countJson['totalPages'];
					pagesize = jsonData.countJson['pagesizec'];

					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;

					startIn = (currentPage -1)*pagesize;
					endIn = startIn + pagesize;

					startIn = startIn+1;
					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;

					if(totalRecords <= 0)
						totalRecords = 1;

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();

					if(!Ext.isEmpty(jsonData))
					{
						this.displayVDGridData(url,jsonData,totalRecords,totalPageNo,gridMsg,itemType,combo,isCombo);
					}
					if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
					{
						Ext.getCmp('afterTextColumn').setValue('1');
					}

					var val = 1;
					if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						val = pageNo;
					
					if(Ext.getCmp('afterTextColumn'))
					{
						Ext.getCmp('afterTextColumn').setValue(val);
						
						if(val == 1 || val == '1')
						{
							Ext.getCmp('firstRec').setDisabled(true);
							Ext.getCmp('prevRec').setDisabled(true);
							if(val == totalRecords){
								Ext.getCmp('nextRec').setDisabled(true);
								Ext.getCmp('lastRec').setDisabled(true);
							}
						}
						else if(val == totalRecords)
						{
							Ext.getCmp('nextRec').setDisabled(true);
							Ext.getCmp('lastRec').setDisabled(true);
						}
					}
				}
				else if(jsonDataArr.gridArray!=null && jsonDataArr.gridArray!=undefined && jsonDataArr.gridArray!="" && jsonDataArr.gridArray!="undefined" && jsonDataArr.gridArray!="null" && isCombo && !isJsonData)
				{
					for(var m in jsonDataArr.gridArray)
					{
						var obj = jsonDataArr.gridArray[m];
						if(obj.comp_type==combo.getValue())
						{
							jsonData = obj;
							break;
						}
					}
					myMask.hide();
					this.entireData = jsonData;
					this.entireOrgData = jsonData;
					totalRecords = jsonData.countJson['recount'];
					totalPageNo = jsonData.countJson['totalPages'];
					pagesize = jsonData.countJson['pagesizec'];

					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;

					startIn = (currentPage -1)*pagesize;
					endIn = startIn + pagesize;

					startIn = startIn+1;
					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;

					if(totalRecords <= 0)
						totalRecords = 1;

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();

					if(!Ext.isEmpty(jsonData))
					{
						this.displayVDGridData(url,jsonData,totalRecords,totalPageNo,gridMsg,itemType,combo,isCombo);
					}
					if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
					{
						Ext.getCmp('afterTextColumn').setValue('1');
					}

					var val = 1;
					if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						val = pageNo;
					
					if(Ext.getCmp('afterTextColumn'))
					{
						Ext.getCmp('afterTextColumn').setValue(val);
						
						if(val == 1 || val == '1')
						{
							Ext.getCmp('firstRec').setDisabled(true);
							Ext.getCmp('prevRec').setDisabled(true);
							if(val == totalRecords){
								Ext.getCmp('nextRec').setDisabled(true);
								Ext.getCmp('lastRec').setDisabled(true);
							}
						}
						else if(val == totalRecords)
						{
							Ext.getCmp('nextRec').setDisabled(true);
							Ext.getCmp('lastRec').setDisabled(true);
						}
					}
				}
				else
				{
					myMask.hide();

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					me.removeAll();

					//display error message
					var error_msg=jsonData.error;
					var error_panel={
						xtype:'emptypanel',
						style:{'border':'0px solid green !important'},
						border:false,
						margin:0,
						frame:false,
						flex:1,
						bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
						cls:'datapanel',
						items: [{
								xtype: 'container',
								style: {
									'text-align': 'center'
								},
								html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
								}
						]
					};
					this.add(error_panel);
				}
			}});
		}
		else
		{
			// pass only one ajax req for data retrival alone
			Ext.Ajax.request({
				url : url,
				scope:this,
				timeout:280000,
				success: function(response)
				{
					myMask.hide();

					var jsonText = response.responseText;
					var jsonData = Ext.decode(jsonText);
					var jsonDataArr = jsonData;
					var totalRecords =jsonData.countJson['recount'];
					var totalPageNo =jsonData.countJson['totalPages'];
					var pagesize=jsonData.countJson['pagesizec'];
				if(jsonDataArr.gridArray!=null && jsonDataArr.gridArray!=undefined && jsonDataArr.gridArray!="" && jsonDataArr.gridArray!="undefined" && jsonDataArr.gridArray!="null" && isCombo)
				{
					for(var m in jsonDataArr.gridArray)
					{
						var obj = jsonDataArr.gridArray[m];
						if(obj.comp_type==combo.getValue())
						{
							jsonData = obj;
							break;
						}
					}

					totalRecords =jsonData.countJson['recount'];
					totalPageNo =jsonData.countJson['totalPages'];
					pagesize=jsonData.countJson['pagesizec'];

					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;

					startIn = (currentPage -1)*pagesize;
					endIn = startIn + pagesize;
					startIn = startIn+1;

					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;
					if(totalRecords <= 0)
						totalRecords = 1;

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();
					
				}
				else
				{	
					var currentPage = 1;
					if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						currentPage=pageNo;

					startIn = (currentPage -1)*pagesize;
					endIn = startIn + pagesize;
					startIn = startIn+1;

					if(endIn > totalRecords )
						endIn = totalRecords;
					
					gridMsg = startIn+ ' - '+endIn+' of '+totalRecords;
					if(totalRecords <= 0)
						totalRecords = 1;

					var dockedItems = me.getDockedItems('toolbar');
					for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
						me.removeDocked(dockedItems[dockedCounter]);
					}

					if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
						me.removeAll();
				}
					if(!Ext.isEmpty(jsonData))
					{
						myMask.hide();
						this.displayVDGridData(url,jsonData,totalRecords,totalPageNo,gridMsg,itemType,combo,isCombo);
						if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
						{
							Ext.getCmp('afterTextColumn').setValue('1');
						}

					}
					else
					{
						var dockedItems = me.getDockedItems('toolbar');
						for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
							me.removeDocked(dockedItems[dockedCounter]);
						}

						me.removeAll();

						//display error message
						var error_msg=jsonData.error;
						var error_panel={
								xtype:'emptypanel',
								style:{'border':'0px solid green !important'},
								border:false,
								margin:0,
								frame:false,
								flex:1,
								bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
								cls:'datapanel',
								items: [{
										xtype: 'container',
										style: {
											'text-align': 'center'
										},
										html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
										}
								]
						};
						this.add(error_panel);
					}

					var val = 1;
					if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
						val = pageNo;

					if(Ext.getCmp('afterTextColumn'))
					{
						Ext.getCmp('afterTextColumn').setValue(val);
						
						if(val == 1 || val == '1'){
							Ext.getCmp('firstRec').setDisabled(true);
							Ext.getCmp('prevRec').setDisabled(true);
							if(val == totalRecords){
								Ext.getCmp('nextRec').setDisabled(true);
								Ext.getCmp('lastRec').setDisabled(true);
							}
						}else if(val == totalRecords){
							Ext.getCmp('nextRec').setDisabled(true);
							Ext.getCmp('lastRec').setDisabled(true);
						}
					}
				}
			});
		}

		return false;
	},
	loadVDTabJson:function(jsonData,url,itemType,combo,isCombo){
		gCombo = combo;
		isGCombo = isCombo;
		var jsonDataArr = jsonData;
		DirProperty ="";
		sortState ="";

		if(url.indexOf("Refresh=true")>-1)
		{
			url= Refurl;
		}

		var me = this;
		var myMask = null;
		var gridMsg = null;
		var pageNO = null;
		var totalRecords = null;
		var totalPageNo = null;
		var pagesize = null;
		if(!Ext.isEmpty(jsonData))
		{
			this.entireData = jsonData;
			this.entireOrgData = jsonData;
			totalRecords = jsonData.countJson['recount'];
			totalPageNo = jsonData.countJson['totalPages'];
			pagesize = jsonData.countJson['pagesizec'];
		}
		if(jsonDataArr.gridArray!=null && jsonDataArr.gridArray!=undefined && jsonDataArr.gridArray!="" && jsonDataArr.gridArray!="undefined" && jsonDataArr.gridArray!="null" && isCombo)
		{
			for(var m in jsonDataArr.gridArray)
			{
				var obj = jsonDataArr.gridArray[m];
				if(obj.comp_type==combo.getValue())
				{
					jsonData = obj;
					break;
				}
			}
			this.entireData = jsonData;
			this.entireOrgData = jsonData;
			totalRecords = jsonData.countJson['recount'];
			
			totalPageNo = jsonData.countJson['totalPages'];
			pagesize = jsonData.countJson['pagesizec'];
		}
		if(!Ext.isEmpty(jsonData))
		{
			var currentPage = 1;

			if(pageNo != null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
				currentPage=pageNo;
			startIn = (currentPage -1)*pagesize;
			endIn = startIn + pagesize;
			startIn = startIn+1;
			if(endIn > totalRecords )
				endIn = totalRecords;
			
			gridMsg = startIn+ ' - '+endIn+' '+oftxt+' '+totalRecords;

			if(totalRecords <= 0)
				totalRecords = 1;

			var dockedItems = me.getDockedItems('toolbar');
			for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
				me.removeDocked(dockedItems[dockedCounter]);
			}

			if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') < 0)
				me.removeAll();

			this.displayVDGridData(url,jsonData,totalRecords,totalPageNo,gridMsg,itemType,combo,isCombo);

			if(!Ext.isEmpty(Ext.getCmp('afterTextColumn')))
			{
				Ext.getCmp('afterTextColumn').setValue('1');
			}

			var val = 1;
			if(pageNo !=null && pageNo != undefined && pageNo != 'undefined' && typeof(pageNo) == 'number')
				val = pageNo;
			
			if(Ext.getCmp('afterTextColumn'))
			{
				Ext.getCmp('afterTextColumn').setValue(val);
				
				if(val == 1 || val == '1')
				{
					Ext.getCmp('firstRec').setDisabled(true);
					Ext.getCmp('prevRec').setDisabled(true);
					if(val == totalRecords){
						Ext.getCmp('nextRec').setDisabled(true);
						Ext.getCmp('lastRec').setDisabled(true);
					}
				}
				else if(val == totalRecords)
				{
					Ext.getCmp('nextRec').setDisabled(true);
					Ext.getCmp('lastRec').setDisabled(true);
				}
			}
		}
		else
		{
			myMask.hide();

			var dockedItems = me.getDockedItems('toolbar');
			for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
				me.removeDocked(dockedItems[dockedCounter]);
			}

			me.removeAll();

			//display error message
			var error_msg=jsonData.error;

			var error_panel={
				xtype:'emptypanel',
				style:{'border':'0px solid green !important'},
				border:false,
				margin:0,
				frame:false,
				flex:1,
				bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
				cls:'datapanel',
				items: [{
						xtype: 'container',
						style: {
							'text-align': 'center'
						},
						html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
						}
				]
			};
			
		}
	},
	displayVDGridData:function(url,jsonData_org,totalRecords,totalPageNo,gridMsg,itemType,combo,isCombo){
		
		var isIE = false;
		var isIEEdge = false;
		
		if (GetIEVersion() == 11) 
			isIE = true;
		else if (GetIEVersion() == 12) 
			isIEEdge = true;

		var jsonData = jsonData_org;
		var jsonDataArr = jsonData_org;
		var OrgItemId=this.itemId;
		var storeFields=new Array();
		var columns=new Array();
		var itemIdGrid = this.itemId;
		glUrl = url;
		Refurl = url;
		if(url.indexOf("&DirProperty=")>-1)
		{
			var data=url.split("&DirProperty=");
			if(data[1].indexOf("&")==-1)
			{
				DirProperty=data[1];
				url = data[0];
			}
			else if(data[1].indexOf("&")>-1)
			{
				DirProperty=data[1].substr(0,data[1].indexOf("&"));
				url = data[0]+data[1].substr(data[1].indexOf("&")+1);
			}
		}
		else if(url.indexOf("DirProperty=")>-1)
		{
			var data=url.split("DirProperty=");
			if(data[1].indexOf("&")==-1)
			{
				DirProperty=data[1];
				url = data[0];
			}
			else if(data[1].indexOf("&")>-1)
			{
				DirProperty=data[1].substr(0,data[1].indexOf("&"));
				url = data[0]+data[1].substr(data[1].indexOf("&")+1);
			}
		}
		if(url.indexOf("orderBy=")>-1)
		{
			var data=url.split("&orderBy=");
			if(data[1].indexOf("&")==-1)
			{
				sortState=data[1];
			}
			else if(data[1].indexOf("&")>-1)
			{
				sortState=data[1].substr(0,data[1].indexOf("&"));
			}
		}


		if(jsonDataArr.gridArray!=null && jsonDataArr.gridArray!=undefined && jsonDataArr.gridArray!="" && jsonDataArr.gridArray!="undefined" && jsonDataArr.gridArray!="null")
		{
			
			for(var m in jsonDataArr.gridArray)
			{
				var obj = jsonDataArr.gridArray[m];
				if(obj.comp_type==combo.getValue())
				{
					jsonData = obj;
					break;
				}
			}
			var columns=new Array();
			var storeFields=new Array();
			var total = 0;
			storeFields.push("state");
			
			for(var j=0;j<jsonData.headers.length;j++)
			{
				if(!isNaN(parseInt(jsonData.headers[j].columnWidth)))
				{
					total+=parseInt(jsonData.headers[j].columnWidth);
				}
			}
			var columnInd=3;
			if(itemType!=null && (itemType == 'hoststab' || itemType == 'datastoretab' || itemType=='virtualcentertab'))
			{
				columnInd=2;
			}
			else if(itemType!=null && itemType == 'virtualtab' && (jsonData.headers[2].text=="HOST" || jsonData.headers[2].text=="host" || jsonData.headers[2].text=="Host"))
			{
				columnInd=3;
			}
			else
			{
				if(jsonData.headers[2].text=="HOST" || jsonData.headers[2].text=="host" || jsonData.headers[2].text=="Host")
					columnInd=3;
				else
					columnInd=2;
			}
			for(var j=0;j<columnInd;j++)
			{
				var recMeasureCol=jsonData.headers[j];
				var measureCol=new Object();
				measureCol.text=recMeasureCol.text;
				measureCol.locked=recMeasureCol.locked;
				measureCol.width=recMeasureCol.colWidth;
				
				var measureColText=measureCol.text;
				measureCol.menuDisabled = true;
				measureCol.dataIndex=recMeasureCol.dataIndex;
				measureCol.style="text-align:center";
				
				if(recMeasureCol.dataIndex == "value-1"){
					//measureCol.width=47;
					measureCol.text="";
					measureCol.menuDisabled=true;
					measureCol.sortable=false;
				}
				
				measureCol.renderer=function(value,metaData,record,rowIndex,colIndex){
					var dataIndex =jsonData.headers[colIndex].dataIndex;
					var headerVal =jsonData.headers[colIndex];
					var returnValue = "";
					if(dataIndex == "value-1"){
						//returnValue += '<img src="'+record.get('state')+'"/>';
						returnValue += '<div class="'+record.get('state')+'"></div>';
					}
					//if(dataIndex == "value0"){
						//returnValue +=record.get('value0');
					//}
					if(!Ext.isEmpty(record.get(dataIndex+"_image"))){
						//returnValue += '<img src="'+record.get(dataIndex+"_image")+'">';
						returnValue += '<span style="display:inline-block;text-align:center;width:100%"><img src="/final/images/clear.png" class="'+record.get(dataIndex+"_image")+'"></span>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex+"_progress"))){
						returnValue += '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:125px"><col width="80px"><col width="45px">'
						  +'<tr>'
						  +'<td style="padding-right:7px">'
						  +'<table width="80px" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
								 +'<tr>'
								 +'<td align="left" width="100%" height="6" class="prog_line" >'
									+'<table width="'+record.get(dataIndex+"_progress")+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
									+'<tr>'
									+'<td class="progress_GOOD" width="100%"></td>'
									+'</tr>'
									+'</table>'
								 +'</td>'
								 +'</tr>'
						 +'</table>'
						 +'</td>'
						+'<td align="left" style="width:45px">'+record.get(dataIndex)+'</td>'
						 +'</tr>'
						 +'</table>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex+"_url"))){
						returnValue += '<a href="javascript:void(0);" data-qtip="'+value+'" data-qclass="yellowTip" style="position:relative;padding-top:2px;padding-left:5px;" onclick=';
						if(!Ext.isEmpty(record.get(dataIndex+"_urlToLayers"))){
							returnValue += 'goToLayerModelNew("'+record.get(dataIndex+"_url")+'")';
						} else {
							returnValue += 'goToVmMeasuresNew("'+record.get(dataIndex+"_url")+'")';
						}
						returnValue += '>' + record.get(dataIndex)+'</a>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex)) && Ext.isEmpty(record.get(dataIndex+"_url")) && Ext.isEmpty(record.get(dataIndex+"_progress"))){
						if(headerVal.text == "Name"){
							returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'>"+record.get(dataIndex)+"</p>";
						}else{
							returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'>"+record.get(dataIndex)+"</p>";
						}
					}
					return returnValue;
				};
				var fieldType = {
					name:recMeasureCol.dataIndex,
					sortType:recMeasureCol.textType
				};
				//console.log(fieldType);
				storeFields.push(fieldType);
				storeFields.push(recMeasureCol.dataIndex + "_url");
				storeFields.push(recMeasureCol.dataIndex + "_image");
				storeFields.push(recMeasureCol.dataIndex + "_progress");
				columns.push(measureCol);
			}
			for(var j=columnInd;j<jsonData.headers.length;j++)
			{
				var me=this;
				var recMeasureCol=jsonData.headers[j];
				
				var measureCol=new Object();
				measureCol.text=recMeasureCol.text;
				if(!Ext.isEmpty(recMeasureCol.unit) && recMeasureCol.unit!=null && recMeasureCol.unit!=undefined)
				{
					measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
					if(isIE || isIEEdge)
						measureCol.text = '<span>'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
				}
				else
				{
					measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span>';
					if(isIE || isIEEdge)
						measureCol.text = '<span>'+recMeasureCol.text+'</span>';
				}
				var measureColText=measureCol.text;
				measureCol.menuDisabled = true;
				measureCol.dataIndex=recMeasureCol.dataIndex;
				measureCol.style="text-align:center";
				if(jsonData.headers != undefined && jsonData.headers != 'undefined')
				{
					measureCol.sortByColumn=jsonData.headers[j].sortByColumn;
					measureCol.SortTypeForCompName=jsonData.headers[j].SortTypeForCompName;
					measureCol.SortTypeOrg=jsonData.headers[j].SortTypeOrg;
					measureCol.url=url;
					measureCol.totalRecords=totalRecords;
					measureCol.totalPageNo=totalPageNo;
					measureCol.itemType=itemType;
				}
				else
				{
					measureCol.SortTypeForCompName='';
					measureCol.SortTypeOrg='desc';
					measureCol.sortByColumn='';
					measureCol.url=url;
					measureCol.totalRecords=totalRecords;
					measureCol.totalPageNo=totalPageNo;
					measureCol.itemType=itemType;
				}

				measureCol.listeners= {
					'headerclick':function(gridheader,eventobj,tml){
						sortState=eventobj.SortTypeOrg.toUpperCase();
						DirProperty=eventobj.dataIndex;
						var temUrl=eventobj.url;
						if(temUrl.indexOf("&pageNo=")>-1)
						{
							var data=temUrl.split("&pageNo=");
							if(data[1].indexOf("&")==-1)
							{
								temUrl = data[0];
							}
							else if(data[1].indexOf("&")>-1)
							{
								temUrl = data[0]+data[1].substr(data[1].indexOf("&")+1);
							}
						}
						else if(temUrl.indexOf("pageNo=")>-1)
						{
							var data=url.split("pageNo=");
							if(data[1].indexOf("&")==-1)
							{
								temUrl = data[0];
							}
							else if(data[1].indexOf("&")>-1)
							{
								temUrl = data[0]+data[1].substr(data[1].indexOf("&")+1);
							}
						}

						me.sortByVDMeasureValues(temUrl,eventobj.totalRecords,eventobj.totalPageNo,eventobj.itemType,eventobj.sortByColumn,eventobj.SortTypeForCompName.toUpperCase(),eventobj.dataIndex,combo,isCombo);
					}
				};
				if(!Ext.isEmpty(recMeasureCol.columnWidth)){
					/*var colsCount=jsonData.headers.length;
					var colsCountLen=colsCount-columnInd;
					if(colsCountLen!=null && colsCountLen<=6)
					{
						measureCol.flex=1;
					}
					else
					{
						if(recMeasureCol.columnWidth.search("%")!=-1){
							measureCol.width=recMeasureCol.columnWidth;
						}
						else
						{
							
							if(recMeasureCol.text.indexOf("%") > -1 )
							{
								measureCol.width=150;
							}
							else if(recMeasureCol.text.length > 12 )
							{
								measureCol.width=recMeasureCol.text.length*5;
							}
							else
							{
								var newwidth=(parseInt(recMeasureCol.columnWidth)/total)*100;
								measureCol.width=newwidth+'%';
							}
						}
					}*/
				}
				else if(recMeasureCol.dataIndex == "value-1"){
					measureCol.width=47;
					measureCol.text="";
					measureCol.menuDisabled=true;
					measureCol.sortable=false;
				}
				else if(recMeasureCol.dataIndex == "value0"){
					/*var colsCount=jsonData.headers.length;
					if (colsCount<10)
					{
					
						if (colsCount==7)
						{
							if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
								measureCol.flex=1.0;
						}
						else
						{
							if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
								measureCol.width='35%';
						}
						

					}
					
					else if (colsCount<6)
					{
						if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
							measureCol.width='36%';

					}
					else
					{
						if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
						measureCol.width='24.90%';

					}*/
				}
				else if(recMeasureCol.dataIndex == "value1"){
					if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
						measureCol.width=parseInt(recMeasureCol.colWidth)+30;
				}
				else {
					//measureCol.flex=1;
				}
				measureCol.renderer=function(value,metaData,record,rowIndex,colIndex){
				var isLocked=false;
				var veryFirstCol = columns[0];
				var veryFirstCol1 = columns[1];
				if(!Ext.isEmpty(veryFirstCol) && veryFirstCol!=undefined && veryFirstCol!=null && !Ext.isEmpty(veryFirstCol1) && veryFirstCol1!=undefined && veryFirstCol1!=null )
				{
					try
					{
						if(!Ext.isEmpty(veryFirstCol.locked) && veryFirstCol.locked!=undefined && veryFirstCol.locked!=null && (veryFirstCol.locked==true || veryFirstCol1.locked==true ))
						{
							isLocked=true;
						}
						else
						{
							isLocked=false;
						}
					}
					catch (e)
					{
						isLocked=false;
					}
				}
				
				if(isLocked)
				{
					colIndex = colIndex + columnInd;
				}
				var currentCol =jsonData.headers[colIndex];
				if(currentCol!=null && currentCol!=undefined && currentCol!="undefined" && currentCol!="null")
					var dataIndex =currentCol.dataIndex;
				var headerVal =currentCol;
				var returnValue = "";
				var strDecimal='';
				var str='';
				var columnVal=record.get(dataIndex);
				
				if(!isNaN(parseFloat(columnVal)))
				{
					if(columnVal!=null && columnVal.indexOf(".")>-1)
					{
						strDecimal = columnVal.substring(columnVal.indexOf("."));
						str = columnVal.substring(0,columnVal.indexOf("."));
						columnVal='<span class="decimal-align">'+str+'</span><span class="decimal-align2">'+strDecimal+'</span>';
					}
					else
					{
						columnVal='<span class="decimal-align">'+columnVal+'</span>';
					}
				}
				

					if(dataIndex == "value-1"){
						//returnValue += '<img src="'+record.get('state')+'"/>';
						returnValue += '<div class="'+record.get('state')+'"></div>';
					}
					if(!Ext.isEmpty(record.get(dataIndex+"_image"))){
						//returnValue += '<img src="'+record.get(dataIndex+"_image")+'">';
						returnValue += '<span style="display:inline-block;text-align:center;width:100%"><img src="/final/images/clear.png" class="'+record.get(dataIndex+"_image")+'"></span>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex+"_progress"))){
						returnValue += '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:125px"><col width="80px"><col width="45px">'
						  +'<tr>'
						  +'<td style="padding-right:7px">'
						  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
								 +'<tr>'
								 +'<td align="left" width="100%" height="6" class="prog_line" >'
									+'<table width="'+record.get(dataIndex+"_progress")+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
									+'<tr>'
									+'<td class="progress_GOOD" width="100%"></td>'
									+'</tr>'
									+'</table>'
								 +'</td>'
								 +'</tr>'
						 +'</table>'
						 +'</td>'
						//+'<td align="left" style="width:45px">'+record.get(dataIndex)+'</td>'
						+'<td align="left" style="width:45px">'+columnVal+'</td>'
						 +'</tr>'
						 +'</table>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex+"_url"))){
						returnValue += '<a href="javascript:void(0);" style="position:relative;padding-top:2px;padding-left:5px;" onclick=';
						if(!Ext.isEmpty(record.get(dataIndex+"_urlToLayers"))){
							returnValue += 'goToLayerModelNew("'+record.get(dataIndex+"_url")+'")';
						} else {
							returnValue += 'goToVmMeasuresNew("'+record.get(dataIndex+"_url")+'")';
						}
						returnValue += '>' +columnVal+'</a>';
					}
					else if(!Ext.isEmpty(record.get(dataIndex)) && Ext.isEmpty(record.get(dataIndex+"_url")) && Ext.isEmpty(record.get(dataIndex+"_progress"))){
					
						if(headerVal.text == "Name"){
							if(columnVal==='-')
							{
								returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'><span class='decimal-align'>"+columnVal+"</span></p>";
							}
							else
							{
								returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'>"+columnVal+"</p>";
							}
						}else{
							
							if(columnVal==='-')
							{
								returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'><span class='decimal-align'>"+columnVal+"</span></p>";
							}
							else
							{
								returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'>"+columnVal+"</p>";
							}
						}
					}
					return returnValue;
				};
				var fieldType = {
					name:recMeasureCol.dataIndex,
					sortType:recMeasureCol.textType,
				};
				storeFields.push(fieldType);
				storeFields.push(recMeasureCol.dataIndex + "_url");
				storeFields.push(recMeasureCol.dataIndex + "_image");
				storeFields.push(recMeasureCol.dataIndex + "_progress");
				columns.push(measureCol);
			}
		}
		else
		{
			if(jsonData != null && jsonData != "undefined" && jsonData != undefined && jsonData != "" )
			{
				if(jsonData.error==null || jsonData.error==undefined || jsonData.error=="" || jsonData.error=="undefined" || jsonData.error=="null")
				{
					var total = 0;
					for(var j=0;j<jsonData.headers.length;j++){
						if(!isNaN(parseInt(jsonData.headers[j].columnWidth)))
						{
							total+=parseInt(jsonData.headers[j].columnWidth);
						}
					}
					var columnInd=3;
					if(itemType!=null && (itemType == 'hoststab' || itemType == 'datastoretab' || itemType=='virtualcentertab'))
					{
						columnInd=2;
					}
					else if(itemType!=null && itemType == 'virtualtab' && (jsonData.headers[2].text=="HOST" || jsonData.headers[2].text=="host" || jsonData.headers[2].text=="Host"))
					{
						columnInd=3;
					}
					else
					{
						//if(jsonData.headers[2]!= "undefined" && jsonData.headers[2] != undefined && jsonData.headers[2] != "" )
						{
							if(jsonData.headers[2].text=="HOST" || jsonData.headers[2].text=="host" || jsonData.headers[2].text=="Host")
								columnInd=3;
							else
								columnInd=2;
						}
					}
					storeFields.push("state");
					for(var j=0;j<columnInd;j++)
					{
						var recMeasureCol=jsonData.headers[j];
						
						var measureCol=new Object();
						measureCol.text=recMeasureCol.text;
						measureCol.width=recMeasureCol.colWidth;
						measureCol.locked=recMeasureCol.locked;
						
						var measureColText=measureCol.text;
						measureCol.menuDisabled = true;
						measureCol.dataIndex=recMeasureCol.dataIndex;
						measureCol.style="text-align:center";

						measureCol.url=url;
						measureCol.totalRecords=totalRecords;
						measureCol.totalPageNo=totalPageNo;
						measureCol.itemType=itemType;

						if(recMeasureCol.dataIndex == "value-1"){
							measureCol.text="";
							measureCol.menuDisabled=true;
							measureCol.sortable=false;
						}
						measureCol.listeners= {
									'headerclick':function(gridheader,eventobj,tml){
										sortState='';
										DirProperty='';
										me.sortByVDMeasureValues(eventobj.url,eventobj.totalRecords,eventobj.totalPageNo,eventobj.itemType,'','',DirProperty,combo,isCombo);
									}
						};
						measureCol.renderer=function(value,metaData,record,rowIndex,colIndex){
						var currentCol =jsonData.headers[colIndex];
						var dataIndex =currentCol.dataIndex;
						var headerVal =currentCol;
							var returnValue = "";
							if(dataIndex == "value-1"){
								returnValue += '<div style="margin-left:-7px" class="'+record.get('state')+'"></div>';
							}
							if(!Ext.isEmpty(record.get(dataIndex+"_image"))){
								returnValue += '<span style="display:inline-block;text-align:center;width:100%"><img src="/final/images/clear.png" class="'+record.get(dataIndex+"_image")+'"></span>';
							}
							else if(!Ext.isEmpty(record.get(dataIndex+"_progress"))){
								returnValue += '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:125px"><col width="80px"><col width="45px">'
								  +'<tr>'
								  +'<td style="padding-right:7px">'
								  +'<table width="80" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
										 +'<tr>'
										 +'<td align="left" width="100%" height="6" class="prog_line" >'
											+'<table width="'+record.get(dataIndex+"_progress")+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
											+'<tr>'
											+'<td class="progress_GOOD" width="100%"></td>'
											+'</tr>'
											+'</table>'
										 +'</td>'
										 +'</tr>'
								 +'</table>'
								 +'</td>'
								+'<td align="left" style="width:45px">'+record.get(dataIndex)+'</td>'
								 +'</tr>'
								 +'</table>';
							}
							else if(!Ext.isEmpty(record.get(dataIndex+"_url"))){
								returnValue += '<a href="javascript:void(0);" style="position:relative;padding-top:2px;padding-left:5px;" onclick=';
								if(!Ext.isEmpty(record.get(dataIndex+"_urlToLayers"))){
									returnValue += 'goToLayerModelNew("'+record.get(dataIndex+"_url")+'")';
								} else {
									returnValue += 'goToVmMeasuresNew("'+record.get(dataIndex+"_url")+'")';
								}
								returnValue += '>' + record.get(dataIndex)+'</a>';
								metaData.tdAttr = 'data-qtip="'+value+'" data-qclass=yellowTip ';
							}
							else if(!Ext.isEmpty(record.get(dataIndex)) && Ext.isEmpty(record.get(dataIndex+"_url")) && Ext.isEmpty(record.get(dataIndex+"_progress"))){
								if(headerVal.text == "Name"){
									returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'>"+record.get(dataIndex)+"</p>";
									
								}else{
									returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'>"+record.get(dataIndex)+"</p>";
									
								}
							}
							return returnValue;
						};
						var fieldType = {
							name:recMeasureCol.dataIndex,
							sortType:recMeasureCol.textType
						};
						storeFields.push(fieldType);
						storeFields.push(recMeasureCol.dataIndex + "_url");
						storeFields.push(recMeasureCol.dataIndex + "_image");
						storeFields.push(recMeasureCol.dataIndex + "_progress");
						columns.push(measureCol);
					}
					for(var j=columnInd;j<jsonData.headers.length;j++)
					{
						var me=this;
						var recMeasureCol=jsonData.headers[j];
						
						var measureCol=new Object();
						measureCol.text=recMeasureCol.text;
						var measureColText=measureCol.text;
						if(!Ext.isEmpty(recMeasureCol.unit) && recMeasureCol.unit!=null && recMeasureCol.unit!=undefined)
						{
							measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
							if(isIE || isIEEdge)
								measureCol.text = '<span>'+recMeasureCol.text+'</span></br><span class="gridUnitText" style="display:inline-block;">'+recMeasureCol.unit+'</span>';
						}
						else
						{
							measureCol.text = '<span style="margin-top:0px;display:inline-block">'+recMeasureCol.text+'</span>';
							if(isIE || isIEEdge)
								measureCol.text = '<span>'+recMeasureCol.text+'</span>';
						}
						measureCol.menuDisabled = true;
						measureCol.dataIndex=recMeasureCol.dataIndex;
						measureCol.style="text-align:center";
						measureCol.minWidth = 150;
						if(jsonData.headers != undefined && jsonData.headers != 'undefined')
						{
							measureCol.sortByColumn=jsonData.headers[j].sortByColumn;
							measureCol.SortTypeForCompName=jsonData.headers[j].SortTypeForCompName;
							measureCol.SortTypeOrg=jsonData.headers[j].SortTypeOrg;
							measureCol.url=url;
							measureCol.totalRecords=totalRecords;
							measureCol.totalPageNo=totalPageNo;
							measureCol.itemType=itemType;
						}
						else
						{
							measureCol.SortTypeForCompName='';
							measureCol.SortTypeOrg='desc';
							measureCol.sortByColumn='';
							measureCol.url=url;
							measureCol.totalRecords=totalRecords;
							measureCol.totalPageNo=totalPageNo;
							measureCol.itemType=itemType;
						}

						measureCol.listeners= {
							'headerclick':function(gridheader,eventobj,tml){
								sortState=eventobj.SortTypeOrg.toUpperCase();
								DirProperty=eventobj.dataIndex;
								var temUrl=eventobj.url;
								if(temUrl.indexOf("&pageNo=")>-1)
								{
									var data=temUrl.split("&pageNo=");
									if(data[1].indexOf("&")==-1)
									{
										temUrl = data[0];
									}
									else if(data[1].indexOf("&")>-1)
									{
										temUrl = data[0]+data[1].substr(data[1].indexOf("&")+1);
									}
								}
								else if(temUrl.indexOf("pageNo=")>-1)
								{
									var data=url.split("pageNo=");
									if(data[1].indexOf("&")==-1)
									{
										temUrl = data[0];
									}
									else if(data[1].indexOf("&")>-1)
									{
										temUrl = data[0]+data[1].substr(data[1].indexOf("&")+1);
									}
								}

								me.sortByVDMeasureValues(temUrl,eventobj.totalRecords,eventobj.totalPageNo,eventobj.itemType,eventobj.sortByColumn,eventobj.SortTypeForCompName.toUpperCase(),eventobj.dataIndex);
							}
						};
						if(!Ext.isEmpty(recMeasureCol.columnWidth)){
							/*var colsCount=jsonData.headers.length;
							var colsCountLen=colsCount-columnInd;
							if(colsCountLen!=null && colsCountLen<=6)
							{
								measureCol.flex=1;
							}
							else
							{
								if(recMeasureCol.columnWidth.search("%")!=-1){
									measureCol.width=recMeasureCol.columnWidth;
								}
								else
								{
									
									if(recMeasureCol.text.indexOf("%") > -1 )
									{
										measureCol.width=150;
									}
									else if(recMeasureCol.text.length > 12 )
									{
										measureCol.width=recMeasureCol.text.length*5;
									}
									else
									{
										var newwidth=(parseInt(recMeasureCol.columnWidth)/total)*100;
										measureCol.width=newwidth+'%';
									}
								}
							}*/
						}
						else if(recMeasureCol.dataIndex == "value-1"){
							measureCol.width=47;
							measureCol.text="";
							measureCol.menuDisabled=true;
							measureCol.sortable=false;
						}
						else if(recMeasureCol.dataIndex == "value0"){
							/*var colsCount=jsonData.headers.length;
							if (colsCount<10)
							{
							
								if (colsCount==7)
								{
									if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
										measureCol.flex=1.0;
								}
								else
								{
									if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
										measureCol.width='35%';
								}
								

							}
							
							else if (colsCount<6)
							{
								if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
									measureCol.width='36%';

							}
							else
							{
								if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
								measureCol.width='24.90%';

							}*/
						}
						else if(recMeasureCol.dataIndex == "value1"){
							if(recMeasureCol.colWidth!=null &&  recMeasureCol.colWidth!=undefined)
								measureCol.width=parseInt(recMeasureCol.colWidth)+30;
						}
						else {
							//measureCol.flex=1;
						}
						measureCol.renderer=function(value,metaData,record,rowIndex,colIndex){
						var isLocked=false;
						var veryFirstCol = columns[0];
						var veryFirstCol1 = columns[1];
						if(!Ext.isEmpty(veryFirstCol) && veryFirstCol!=undefined && veryFirstCol!=null && !Ext.isEmpty(veryFirstCol1) && veryFirstCol1!=undefined && veryFirstCol1!=null )
						{
							try
							{
								if(!Ext.isEmpty(veryFirstCol.locked) && veryFirstCol.locked!=undefined && veryFirstCol.locked!=null && (veryFirstCol.locked==true || veryFirstCol1.locked==true ))
								{
									isLocked=true;
								}
								else
								{
									isLocked=false;
								}
							}
							catch (e)
							{
								isLocked=false;
							}
						}
						
						if(isLocked)
						{
							colIndex = colIndex + columnInd;
						}
						var currentCol =jsonData.headers[colIndex];
						if(currentCol!=null && currentCol!=undefined && currentCol!="undefined" && currentCol!="null")
							var dataIndex =currentCol.dataIndex;
						var headerVal =currentCol;
						var returnValue = "";
						var strDecimal='';
						var str='';
						var columnVal=record.get(dataIndex);
						
						if(!isNaN(parseFloat(columnVal)))
						{
							if(columnVal!=null && columnVal.indexOf(".")>-1)
							{
								strDecimal = columnVal.substring(columnVal.indexOf("."));
								str = columnVal.substring(0,columnVal.indexOf("."));
								columnVal='<span class="decimal-align">'+str+'</span><span class="decimal-align2">'+strDecimal+'</span>';
							}
							else
							{
								columnVal='<span class="decimal-align">'+columnVal+'</span>';
							}
						}
						

							if(dataIndex == "value-1"){
								//returnValue += '<img src="'+record.get('state')+'"/>';
								returnValue += '<div class="'+record.get('state')+'"></div>';
							}
							if(!Ext.isEmpty(record.get(dataIndex+"_image"))){
								//returnValue += '<img src="'+record.get(dataIndex+"_image")+'">';
								returnValue += '<span style="display:inline-block;text-align:center;width:100%"><img src="/final/images/clear.png" class="'+record.get(dataIndex+"_image")+'"></span>';
							}
							else if(!Ext.isEmpty(record.get(dataIndex+"_progress"))){
								returnValue += '<table cellspacing="0" cellpadding="0" border="0" style="table-layout:auto;margin:auto;width:125px"><col width="80px"><col width="45px">'
								  +'<tr>'
								  +'<td style="padding-right:7px">'
								  +'<table width="80px" cellpadding="0" cellspacing="0" border="0"  height="6" class="prog_border">'
										 +'<tr>'
										 +'<td align="left" width="100%" height="6" class="prog_line" >'
											+'<table width="'+record.get(dataIndex+"_progress")+'%" height="6" cellpadding="0" cellspacing="0" border="0">'
											+'<tr>'
											+'<td class="progress_GOOD" width="100%"></td>'
											+'</tr>'
											+'</table>'
										 +'</td>'
										 +'</tr>'
								 +'</table>'
								 +'</td>'
								//+'<td align="left" style="width:45px">'+record.get(dataIndex)+'</td>'
								+'<td align="left" style="width:45px">'+columnVal+'</td>'
								 +'</tr>'
								 +'</table>';
							}
							else if(!Ext.isEmpty(record.get(dataIndex+"_url"))){
								returnValue += '<a href="javascript:void(0);" style="position:relative;padding-top:2px;padding-left:5px;" onclick=';
								if(!Ext.isEmpty(record.get(dataIndex+"_urlToLayers"))){
									returnValue += 'goToLayerModelNew("'+record.get(dataIndex+"_url")+'")';
								} else {
									returnValue += 'goToVmMeasuresNew("'+record.get(dataIndex+"_url")+'")';
								}
								returnValue += '>' +columnVal+'</a>';
							}
							else if(!Ext.isEmpty(record.get(dataIndex)) && Ext.isEmpty(record.get(dataIndex+"_url")) && Ext.isEmpty(record.get(dataIndex+"_progress"))){
							
								if(headerVal.text == "Name"){
									if(columnVal==='-')
									{
										returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'><span class='decimal-align'>"+columnVal+"</span></p>";
									}
									else
									{
										returnValue += "<p style='width:70px;border:0px solid blue;text-align:center !important;display:table'>"+columnVal+"</p>";
									}
								}else{
									
									if(columnVal==='-')
									{
										returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'><span class='decimal-align'>"+columnVal+"</span></p>";
									}
									else
									{
										returnValue += "<p style='width:70px;margin:auto;border:0px solid blue;text-align:center !important;display:table'>"+columnVal+"</p>";
									}
								}
							}
							return returnValue;
						};
						var fieldType = {
							name:recMeasureCol.dataIndex,
							sortType:recMeasureCol.textType,
						};
						storeFields.push(fieldType);
						storeFields.push(recMeasureCol.dataIndex + "_url");
						storeFields.push(recMeasureCol.dataIndex + "_image");
						storeFields.push(recMeasureCol.dataIndex + "_progress");
						columns.push(measureCol);
					}
				}
			}
		}

		var gridStore=Ext.create('Ext.data.Store',{
			fields:storeFields,
			remoteSort: true,
			autoDestroy:true,
			proxy: {
				type: 'memory',
				reader: {
					type: 'json',
					root:'items',
					totalProperty: 'totalCount',
				}
			},
			data:jsonData,
			sorters:
			{
				property: DirProperty,
				direction: sortState
			}
		});

		var addContainer=Ext.create('Ext.container.Container',{
			xtype:'container',
			flex:1,
			layout:{
				type:'vbox',
				align:'stretch'
			},
			items:[{
				xtype:'panel',
				cls:'dataPanel',
				autoScroll:false,
				scroll:false,
				flex:1,
				layout:{
					type:'vbox',
					align:'stretch'
				},
				id:'gridContainer'
			}]
		});

		if(gridStore!=null)
		{
			var gridPanel = this.down('generalMeasuresGrid');


			if(!Ext.isEmpty(urlForRefresh) && urlForRefresh.indexOf('Refreshing=true') > -1)
			{
				gridPanel.getStore().loadRawData(jsonData);
			}
			else
			{
				
				this.add(addContainer);

				var systemGrid=null;
				if(gridStore.getCount()==0)
				{
					var emptyTextVal='No Data Found';
					
					
					if(jsonData.error!=null && jsonData.error!=undefined && jsonData.error!="" && jsonData.error!="undefined")
					{
						emptyTextVal=jsonData.error;
					}
					
					systemGrid=Ext.create('Ext.panel.Panel',{
						//cls:'gridSkin gridSkin_locking',
						ui:'newGridPanel',
						margin:10,
						frame:false,
						border:false,
						layout:{type:'vbox',pack:'center'}, // iconExclamation center
						flex:1,
						items: [{
								xtype: 'container',
								width:'100%',
								style: {
								'text-align': 'center'
								},
								html: '<div class = "iconInformation" style="margin:0% auto 0px auto"></div><div>'+emptyTextVal+'</div>'
							}
						],
					});
				}
				else
				{
					var gridCls="";
					var isLock=false;

					//gridCls="gridSkin gridSkin_locking";
					gridCls="newGridPanel newGridPanelBorder";
					isLock=true;
					
					var margin = 8;
					/* This view is called in Comparsion app 
					* isLogonFromService is boolean variable 
					* to set margin in user Exp tab 
					*/

					systemGrid=Ext.create('GeneralMeasuresGrid',{
						plugins:Ext.create('Ext.ux.AutoColumnWithLockingPlugin'),
						columns:columns,
						itemId:'generalMeasuresGrid',
						//cls:gridCls,
						ui:gridCls,
						margin:margin,
						border:false,
						layout:'fit',
						enableLocking:isLock,
						flex:1,
						store:gridStore,
						viewConfig: {
							emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>'
						},
						dockedItems: [{
							//hidden:jsonData.countJson['isHidePaging'],
							xtype: 'pagingtoolbar',
							style:{'border-top':'none !important'},
							id:'pagingtoolbarCustom',
							store: gridStore,   // same store GridPanel is using
							dock: 'bottom',
							//cls:'pagingtoolbar',
							cls:'newPagination',
							afterPageText:'of '+ totalPageNo,
							displayInfo: true,
							displayMsg: disptxt+' '+ gridMsg,
							moveFirst:function()
							{
								if(glUrl.indexOf("pageNo") > -1)
								{
									glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +'1');
									Refurl=glUrl;
								}
								else
								{
									glUrl=glUrl+"&pageNo=1";
									Refurl=glUrl;
								}

								Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,'1',totalPageNo,itemType,combo,isCombo);
								RefpageVal='1';
								Reftot=totalRecords;
								ReftotalPageno=totalPageNo;
							},
							movePrevious:function()
							{
								var pageVal = Ext.getCmp('afterTextColumn').getValue();
								if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
									return;
								else
								{
									pageVal = pageVal - 1;
									if(glUrl.indexOf("pageNo") > -1)
									{
										glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
										Refurl=glUrl;
									}
									else
									{
										glUrl=glUrl+"&pageNo="+pageVal;
										Refurl=glUrl;
									}

									RefpageVal=pageVal;
									Reftot=totalRecords;
									ReftotalPageno=totalPageNo;
									Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,pageVal,totalPageNo,itemType,combo,isCombo);
								}
							},
							moveNext : function()
							{
								var pageVal = Ext.getCmp('afterTextColumn').getValue();
								if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
									return;
								else if(pageVal==totalPageNo)
								{
									Ext.Msg.alert('alert','No More Pages');
									return;
								}
								else
								{
									pageVal = pageVal + 1;
									if(glUrl.indexOf("pageNo") > -1)
									{
										glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
										Refurl=glUrl;
									}
									else
									{
										glUrl=glUrl+"&pageNo="+pageVal;
										Refurl=glUrl;
									}
									Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,pageVal,totalPageNo,itemType,combo,isCombo);
								}
								RefpageVal=pageVal;
								Reftot=totalRecords;
								ReftotalPageno=totalPageNo;
							},
							moveLast : function()
							{
								var pageVal = Ext.getCmp('afterTextColumn').getValue();
								if(pageVal==totalPageNo)
								{
									Ext.Msg.alert('alert','No More Pages');
									return;
								}
								
								if(glUrl.indexOf("pageNo") > -1)
								{
									glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +totalPageNo);
									Refurl=glUrl;
								}
								else
								{
									glUrl=glUrl+"&pageNo="+totalPageNo;
									Refurl=glUrl;
								}

								Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,totalPageNo,totalPageNo,itemType,combo,isCombo);
								RefpageVal=totalPageNo;
								Reftot=totalRecords;
								ReftotalPageno=totalPageNo;
							},
							onPagingKeyDown:function(field, e)
							{
								var me = this,
								k = e.getKey();
								if (k == e.RETURN) 
								{
									var pageVal = Ext.getCmp('afterTextColumn').getValue();
									if(pageVal == null || pageVal == '' || pageVal == undefined || pageVal == 'undefined')
										return;
									else if(pageVal > totalPageNo)
									{
										Ext.Msg.alert('alert','No More Pages');
										return;
									}
									else
									{
										RefpageVal=pageVal;
										Reftot=totalRecords;
										ReftotalPageno=totalPageNo;
										
										if(glUrl.indexOf("pageNo") > -1)
										{
											glUrl=glUrl.replace(/(pageNo=)[^\&]+/, '$1' +pageVal);
											Refurl=glUrl;
										}
										else
										{
											glUrl=glUrl+"&pageNo="+pageVal;
											Refurl=glUrl;
										}

										Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,pageVal,totalPageNo,itemType,combo,isCombo);
									}
								}
							},
							emptyMsg: "No topics to display"
						}],
						frame:false,
						border:false,
						emptyText: '<div style="margin:11% 0 auto 0"><div class="iconInformation" style="margin:0% auto"></div><div class="commonErrorMsgText">No metrics configured</div></div>',
					});
				}
				Ext.getCmp("gridContainer").add(systemGrid);
				Ext.getCmp("gridContainer").doComponentLayout();
				
			}
		}
		else
		{
			var dockedItems = me.getDockedItems('toolbar');
			for(var dockedCounter = 0 ; dockedCounter < dockedItems.length ; dockedCounter++){
				me.removeDocked(dockedItems[dockedCounter]);
			}
			var error_msg=jsonData.screenLabels[this.screenLabelPath+'.noDataMsg'];
			var error_panel={
					xtype:'emptypanel',
					border:false,
					frame:false,
					layout:'fit',
					flex:1,
					bodyStyle:{'background-color':'transparent !important','background-image':'none !important'},
					cls:'egDummyClass',
					items: [{
							xtype: 'container',
							style: {
								'text-align': 'center'
							},
							html: '<div class = "iconInformation" style="margin:15% auto 0px auto"></div><div>'+error_msg+'</div>'
							}
					]

			};

			this.add(error_panel);
		}
	},
	sortByVDMeasureValues: function(url,totalRecords,totalPageNo,itemType,orderByColumn,orderBy,dataIndex,combo,isCombo)
	{
		if((isCombo == undefined || isCombo == 'undefined' || isCombo == null) || (combo == undefined || combo == 'undefined' || combo == null))
		{
			isCombo = isGCombo;
			combo = gCombo;
		}
		var tem_url = url;

		var pageVal = Ext.getCmp('afterTextColumn').getValue();
		if(pageVal == undefined || pageVal == 'undefined' || pageVal == null)
			pageVal = '1';

		if(tem_url != undefined && tem_url != 'undefined' && tem_url != "" && tem_url != null)
		{
			if(tem_url.indexOf("columnForMeasure=") > -1 && tem_url.indexOf("orderBy=") > -1)
			{
				if(tem_url.indexOf("columnForMeasure=") > -1)
				{
					tem_url=tem_url.replace(/(columnForMeasure=).*?(&)/,'$1' + orderByColumn + '$2');
				}
				if(tem_url.indexOf("orderBy=") > -1)
				{
					tem_url=tem_url.replace(/(orderBy=).*?(&)/,'$1' + orderBy + '$2');
				}
			}
			else
			{
				var urlData = tem_url.split("?");
				var secUrl = urlData[0]+"?"+"columnForMeasure="+orderByColumn+"&orderBy="+orderBy+"&"+urlData[1];
				tem_url = secUrl;
			}
			if(tem_url.indexOf("pageNo=") > -1)
			{
				if(tem_url.indexOf("pageNo=") > -1)
				{
					tem_url=tem_url.replace(/(pageNo=).*?(&)/,'$1' + pageVal + '$2');
				}
			}
			else
			{
				var urlData = tem_url.split("?");
				var secUrl = urlData[0]+"?"+"pageNo="+pageVal+"&"+urlData[1];
				tem_url = secUrl;
			}
		}

		glUrl = tem_url;
		Refurl=glUrl;
		if(Refurl != undefined && Refurl != 'undefined' && Refurl != "" && Refurl != null)
		{
			if(Refurl.indexOf("DirProperty=") > -1)
			{
				if(Refurl.indexOf("DirProperty=") > -1)
				{
					Refurl=Refurl.replace(/(DirProperty=).*?(&)/,'$1' + dataIndex + '$2');
				}
			}
			else
			{
				var urlData = Refurl.split("?");
				var secUrl = urlData[0]+"?"+"DirProperty="+dataIndex+"&"+urlData[1];
				Refurl = secUrl;
			}
		}
		
		requestParams.upperUrl = Refurl;

		Ext.getCmp('perPanel').loadVDTab(glUrl,totalRecords,pageVal,totalPageNo,itemType,combo,isCombo);
	}

});

function sortByMeasure(orderByColumn,orderBy,columnDispName,fromMetricView)
{
	if(orderByColumn==null || orderByColumn==undefined || orderByColumn=="")
	{
		currOrderByColumn="";
		currOrderBy="";
	}
	else if(orderByColumn!=null && orderByColumn!=undefined && orderByColumn!="")
	{
		currOrderByColumn=orderByColumn;
		currOrderBy=orderBy;
		
	}
	if(columnDispName!=null && columnDispName!=undefined && columnDispName!="")
	{
		currColumndispName = columnDispName;
	}

	Ext.getCmp('perPanel').sortByMeasureValues(orderByColumn,orderBy,columnDispName,fromMetricView);
}
function sortByDDMeasure(orderByColumn,orderBy,columnDispName,measureUnit,fromMetricView)
{
	if(orderByColumn==null || orderByColumn==undefined || orderByColumn=="")
	{
		currOrderByColumn="";
		currOrderBy="";
	}
	else if(orderByColumn!=null && orderByColumn!=undefined && orderByColumn!="")
	{
		currOrderByColumn=orderByColumn;
		currOrderBy=orderBy;
		
	}

	if(columnDispName!=null && columnDispName!=undefined && columnDispName!="")
	{
		currColumndispName = columnDispName;
	}
	if(measureUnit!=null && measureUnit!=undefined && measureUnit!="")
	{
		currColumnType = measureUnit;
	}
	if(endUserOverviewFlag)
		isfromuedsort = true;
	Ext.getCmp('perPanel').sortByDDMeasureValues(orderByColumn,orderBy,columnDispName,measureUnit,fromMetricView);
}

function GetIEVersion() {
  var sAgent = window.navigator.userAgent;
  var Idx = sAgent.indexOf("MSIE");

  // If IE, return version number.
  if (Idx > 0) 
    return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));

  // If IE 11 then look for Updated user agent string.
  else if (!!navigator.userAgent.match(/Trident\/7\./)) 
    return 11;

	// Edge (IE 12+) => return version number
  else if (!!navigator.userAgent.match('Edge/'))    
    return 12;

  else
    return 0; //It is not IE
}
