grid view seen in Internet explorer, opera but not in mozilla
We have to display grid in my project. when we run project, grid view is not seen in mozilla but it seen in all browsers. the javascript "grid.js" is given below. Please suggest me changes in it.
"grid.js"
var arrowUp,arrowDown;
var bnGridLoop=false;
var nRowList=0;
initSortTable();
function initSortTable() {
arrowUp = document.createElement("SPAN");
var tn = document.createTextNode("p");
arrowUp.appendChild(tn);
arrowUp.className = "Grid_arrow";
arrowDown = document.createElement("SPAN");
var tn = document.createTextNode("q");
arrowDown.appendChild(tn);
arrowDown.className = "Grid_arrow";
}
function getGridCaption(grDet){
var sRet='<TABLE ID="' + grDet.Name + '"_Table_Caption" border="0" width="100%" cellpadding="0" cellspacing="0">';
sRet += '<TR><TD ID="' + grDet.Name + '"_Grid_Caption" align="' + grDet.CaptionAlignment + '" class="' + grDet.CaptionStyle + '">';
sRet += grDet.Caption + '</TD></TR></TABLE>';
return(sRet);
}
function getRowTableWidth(grDet)
{
var lngRowTableWidth=0;
for (var i=0; i<grDet.Columns.length;i++) {
if (grDet.Columns[i].Hidden!='Y') {
if (i==grDet.Columns.length-1) {
var intGridWidth=toNumber(grDet.Width);
if ((lngRowTableWidth + toNumber(grDet.Columns[i].Width)) < intGridWidth) {
lngRowTableWidth+=intGridWidth-lngRowTableWidth;
if ((grDet.ScrollbarY=='scroll')||(grDet.ScrollbarY=='visible')) lngRowTableWidth-=17;
}
}
else {
lngRowTableWidth+=toNumber(grDet.Columns[i].Width);}
}
}
return(lngRowTableWidth);
}
function getGridFooter(GridID, grDet, ContainerID,TotalRows,GridTag, DataRootTag, DataRowTag){
var sRet='';
var strUnit = grDet.UnitDesignator;
sRet = '<DIV ID="' + grDet.Name + '_Div_Footer" class="Grid_FooterDIV" style="overflow:hidden;height=25' + strUnit + '; width=' + grDet.Width + strUnit + ';"> ';
sRet += '<TABLE ID="' + grDet.Name + '_Table_Footer" style="overflow:scroll; border="1" width="100%" height="100%" cellpadding="0" cellspacing="0">';
sRet += '<TR><TD class="Grid_FooterClass"><TABLE ID="' + grDet.Name + '_Table_Buttons" border="0" cellspacing="0"><TR>';
if (grDet.AllowAddNew=="1"){
sRet += '<TD><INPUT class="Grid_NewDeleteButtons" Name="' + grDet.Name + '_btnAdd" Type="Button" Value="+" Title="Add new row" onclick="';
if(grDet.OvRidAdRw!="") sRet += grDet.OvRidAdRw;
else sRet += 'addRow(\'' + GridID.id + '\',' + grDet.Name + '_Table_Rows,\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\');';
sRet += '" /></TD>';
}
if ((grDet.AllowDelete=="1") && (grDet.HideDeleteButton=="0"))
sRet += '<TD><INPUT class="Grid_NewDeleteButtons" Name="' + grDet.Name + '_btnDelete" Type="Button" Value="-" Title="Delete selected rows" onclick="deleteRow(' + grDet.Name + '_Table_Rows,' + grDet.Name +'chkSelectAll,\'' + grDet.AfterDelete + '\',\''+GridID.id+'\',' + grDet.FreezeColumns + ');" /></TD>';
if (grDet.AllowRowMoving=="1" && TotalRows > 0) {
sRet += '<TD><INPUT class="Grid_MoveUpDownButtons" Name="' + grDet.Name + '_btnUp" Type="Button" Value="5" Title="Move selected rows up" onclick="moveRow(' + grDet.Name + '_Table_Rows,' + grDet.Name + '_chkSelect[], -1,' + grDet.FreezeColumns + ');" /></TD>';
sRet += '<TD><INPUT class="Grid_MoveUpDownButtons" Name="' + grDet.Name + '_btnDown" Type="Button" Value="6" Title="Move selected rows down" onclick="moveRow(' + grDet.Name + '_Table_Rows,' + grDet.Name + '_chkSelect[], 1,' + grDet.FreezeColumns + ');" /></TD>';
}
if (grDet.AllowPaging=="1") {
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnPrev" Title="Previous Page" ID="btnPrev" Type="Button" Value="7" onclick="'+ grDet.PrevPageClick + '" /></TD>';
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnNext" Title="Next Page" ID="btnNext" Type="Button" Value="8" onclick="' + grDet.NextPageClick + '" /></TD>';
}
if (grDet.AllowZoom=="1") {
sRet += '<TD><INPUT Name="' + grDet.Name + '_ZoomValue" Type="Hidden" ID="' + grDet.Name + '_ZoomValue" Value="100">';
sRet += '<input type="image" src="' + IMG_ZOOM_IN + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnZoomIn" Title="Zoom In" ID="' + grDet.Name + '_btnZoomIn" onclick="return doZoom(\'' + ContainerID + '\',\'+\',' + grDet.Name + '_ZoomValue);" /></TD>';
sRet += '<TD><input type="image" src="' + IMG_ZOOM_OUT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnZoomOut" Title="Zoom Out" ID="' + grDet.Name + '_btnZoomIn" onclick="return doZoom(\'' + ContainerID + '\',\'-\',' + grDet.Name + '_ZoomValue);"/></TD>';
}
if (grDet.AllowShowMore!="0") {
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnMore" Type="Button" Value="4" Title="Show / Hide columns" onclick="ShowMoreColumns(\''+ GridID.id + '\',\''+grDet.Name+'\',this);" _bnClickMore="false"/></TD>';
}
if (grDet.AllowExcelExport=="1") sRet += '<TD><input type="image" src="' + IMG_EXPORT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnExport" Value="Export To Excel" Title="Export To Excel" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'EX\');" /></TD>';
if (grDet.AllowPrintPreview=="1") sRet += '<TD><input type="image" src="' + IMG_PREVIEW + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnPrintPreview" Value="Print Priview" Title="Print Priview" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'PP\');" /></TD>';
if (grDet.AllowPrint=="1") sRet += '<TD><input type="image" src="' + IMG_PRINT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnPrint" Value="Print" Title="Print" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'PO\');" /></TD>';
sRet += '</TABLE></TD></TR></TABLE></DIV>';
return(sRet);
}
function getGridRows(grDet, RowList) {
var sRet='';
var showMoreCol;
var strUnit = grDet.UnitDesignator;
var strConForm='';
var intTotalRows=RowList.length;
var lngRowTableWidth=getRowTableWidth(grDet);
if((grDet.FreezeColumns!="0")||(grDet.CollapseColumns=="1")) lngRowTableWidth="0";
var intTotalColumns=grDet.Columns.length;
var strName='';
var colsFreezed=parseInt(grDet.FreezeColumns);
var bnClickMore="false";
var objClickMore=document.getElementById(grDet.Name + "_btnMore");
if (objClickMore!=null) bnClickMore=objClickMore._bnClickMore;
if(grDet.FreezeColumns!="0"){
if(bnGridLoop==true) {
strName="1";//intTotalColumns = colsFreezed;
}
}
sRet += '<TABLE ID="' + grDet.Name + '_Table_Rows'+strName+'" border="0" width="' + lngRowTableWidth + strUnit + '" cellspacing="0" cellpading="0" _ActiveRow="-1" ' ;
if ((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")) sRet += ' _HasCheckBox="1" ';
else sRet += ' _HasCheckBox="0" ';
sRet += ' _HasRowNumbers="' + grDet.RowNumbers + '" ';
sRet += ' _ActiveRowStyle="' + grDet.ActiveRowStyle + '" ';
sRet += ' _OddRowStyle="' + grDet.OddRowStyle + '" ';
sRet += ' _EvenRowStyle="' + grDet.EvenRowStyle + '" ';
sRet += ' _NewRowStyle="' + grDet.NewRowStyle + '" ';
sRet += ' _DeleteRowStyle="' + grDet.DeleteRowStyle + '" ';
sRet += ' Style="table-layout:fixed;" >';
var strOddEvenStyle;
var arrName=new Array(intTotalColumns);
var arrDataType=new Array(intTotalColumns);
var arrWidth=new Array(intTotalColumns);
var arrCase=new Array(intTotalColumns);
var arrAlignment=new Array(intTotalColumns);
var arrControlStyle=new Array(intTotalColumns);
var arrControlStyleMand=new Array(intTotalColumns);
var arrControlType=new Array(intTotalColumns);
var arrControlWidth=new Array(intTotalColumns);
var arrKeyField=new Array(intTotalColumns);
var arrDataField=new Array(intTotalColumns);
var arrHidden=new Array(intTotalColumns);
var arrMaxLength=new Array(intTotalColumns);
var arrAdditionalAttr=new Array(intTotalColumns);
var arrMandatory=new Array(intTotalColumns);
var arrReadonly=new Array(intTotalColumns);
var arrAllowNegative=new Array(intTotalColumns);
var arrOnChangeEvent=new Array(intTotalColumns);
var arrOnClickEvent=new Array(intTotalColumns);
var arrOnDblClickEvent=new Array(intTotalColumns);
var arrDefaultValue=new Array(intTotalColumns);
var arrToolTip=new Array(intTotalColumns);
var arrMulti=new Array(intTotalColumns);
var arrColSum=new Array(intTotalColumns);
var arrShowCol=new Array(intTotalColumns);
var colsVisible=getVisibleCols(grDet);
var colsTag="";
if((grDet.AllowShowMore!="0")||(colsFreezed>0)) colsTag='<COL id="c1"><COL id="c2">';
for (var x=0;x<intTotalColumns;x++) {
arrName[x]=grDet.Columns[x].Name;
arrDataType[x]=grDet.Columns[x].DataType;
arrWidth[x]=grDet.Columns[x].Width;
if(grDet.AllowShowMore!="0" ||colsFreezed>0){
colsTag+='<COL id="c'+arrName[x]+'_rows'+strName+'" ';
if(colsFreezed>0){
if ((bnGridLoop==true) && (x>=(colsFreezed-2)))
arrWidth[x]="1";
if ((bnGridLoop==false) && (x<(colsFreezed-2)))
arrWidth[x]="1";
}
if(grDet.AllowShowMore!="0"){
if (x>=(colsVisible-parseInt(grDet.AllowShowMore)) && (bnClickMore=="false"))
colsTag+=' style="display:none;"';//arrShowCol[x]="0";
}
else if (grDet.Columns[x].Hidden=="Y"){
colsTag+=' style="display:none;"';//arrShowCol[x]="0";
}
colsTag+='>';
}
arrAlignment[x]=grDet.Columns[x].Alignment;
arrControlStyle[x]=grDet.Columns[x].ControlStyle;
arrControlStyleMand[x]=grDet.Columns[x].ControlStyleMand;
arrControlType[x]=grDet.Columns[x].ControlType;
arrControlWidth[x]=grDet.Columns[x].ControlWidth;
arrKeyField[x]=grDet.Columns[x].KeyField;
arrDataField[x]=grDet.Columns[x].DataField;
arrHidden[x]=grDet.Columns[x].Hidden;
arrMaxLength[x]=grDet.Columns[x].MaxLength;
arrAdditionalAttr[x]=grDet.Columns[x].AdditionalAttributes;
arrMandatory[x]=grDet.Columns[x].Mandatory;
arrCase[x]=grDet.Columns[x].Case;
arrReadonly[x]=grDet.Columns[x].Readonly;
arrAllowNegative[x]=grDet.Columns[x].AllowNegative;
arrOnChangeEvent[x]=grDet.Columns[x].OnChangeEvent;
arrOnClickEvent[x]=grDet.Columns[x].OnClickEvent;
arrOnDblClickEvent[x]=grDet.Columns[x].OnDblClickEvent;
arrDefaultValue[x]=grDet.Columns[x].DefaultValue;
arrToolTip[x]=grDet.Columns[x].ToolTipField;
arrMulti[x]=grDet.Columns[x].MultiLine;
arrColSum[x]=grDet.Columns[x].ColumnSummary;
}
sRet +=colsTag;
var strRowHTML='';
for (var i=0;i<intTotalRows; i++) {
if (i%2==0) strOddEvenStyle= grDet.EvenRowStyle;
else strOddEvenStyle= grDet.OddRowStyle;
strRowHTML = '<TR class="' + strOddEvenStyle + '" _oldClass="' + strOddEvenStyle + '" ';
strRowHTML += ' style="height:' + grDet.RowHeight + strUnit + ';" ';
if (grDet.ApplyActiveRowStyle=='1') strRowHTML += ' onclick="setActiveRow(' + grDet.Name + '_Table_Rows'+strName+',this,' + grDet.FreezeColumns + ');"';
strRowHTML += '" _Mode[]="B" >';
strRowHTML += '<TD width="';
if((colsFreezed>0)&&(bnGridLoop==false))
strRowHTML += "1";
else
strRowHTML +=grDet.RowNumberColWidth;
strRowHTML += strUnit + '" class="Grid_RowNumberClass" _oldClass="Grid_RowNumberClass" ';
if (grDet.RowNumbers!="1") strRowHTML += ' style="display:none;"';
strRowHTML += '>';
strRowHTML += (i + 1);
strRowHTML += '</TD>';
strRowHTML += '<TD width="';
if((colsFreezed>0)&&(bnGridLoop==false))
strRowHTML += "1";
else
strRowHTML +=grDet.RowSelectorColWidth;
strRowHTML += strUnit + '" align="center" ';
strRowHTML += ' height=' + grDet.RowHeight + strUnit + '" ';
strRowHTML += ' class="Grid_CheckBoxColumn" ';
if (!((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")))
strRowHTML += ' style="display:none;"';
strRowHTML += ' _oldClass="Grid_CheckBoxColumn" >';
strRowHTML += '<INPUT class="Grid_SelectCheckBox" Type="CheckBox" _Checked="N" Name="'+ grDet.Name + '_chkSelect[]'+strName+'" ID="' + i + '" ';
strRowHTML += ' Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
if((colsFreezed>0)&&(bnGridLoop==true)) strRowHTML += ' onclick="CheckUnfreezedColumn(this,'+i+',\'' + grDet.Name + '\');"';
else strRowHTML += ' onclick="SelectCheckBox_Clicked(this);" ';
strRowHTML += ' />';
strRowHTML += '<Input Type="Hidden" Name="' + grDet.Name + '_mode[]'+strName+'" ID="' + i + '" Value="B" /></TD>';
var strToolTip;
var vCmpValue;
var strfieldValue;
var strControlStyle='';
for (var j=0;j <intTotalColumns; j++) {
strfieldValue='';
strConForm='';
strToolTip='';
if (arrDataField[j]!='') {
if(grDet.DataFromAttrib=='0') strfieldValue=getFieldValue(RowList[i],arrDataField[j]);
else strfieldValue= getAttributeValue(RowList[i],arrDataField[j],'');
}
else strfieldValue='';
if ((strfieldValue=='') && (arrDataType[j] == "Number")) strfieldValue=arrDefaultValue[j];
strRowHTML += '<TD width="' + arrWidth[j] + strUnit + '" Align="' + arrAlignment[j] + '" class="' + strOddEvenStyle + '" _oldClass="' + strOddEvenStyle + '" ';
if (arrHidden[j]=='Y'||arrShowCol[j]=="1") strRowHTML += ' style="display:none;"';
if (grDet.Columns[j].ConditionalFormattingExists == true) strConForm = ApplyConditionalFormatting("C", strfieldValue,arrDataType[j],grDet.Columns[j].ConditionalFormattings,RowList[i],grDet.DataFromAttrib);
if((arrToolTip[j]!=null)&&(arrToolTip[j]!='')) {
if(grDet.DataFromAttrib=='0') strToolTip=getFieldValue(RowList[i],arrToolTip[j]);
else strToolTip=getAttributeValue(RowList[i],arrToolTip[j],'');
}
else if (grDet.SmartTip=='1')
strToolTip=strfieldValue;
strRowHTML += ' title="'+strToolTip+'" ';
strRowHTML += '>'+strConForm;
if (arrMandatory[j]=='Y') strControlStyle = arrControlStyleMand[j];
else strControlStyle = arrControlStyle[j]
if ((strfieldValue!='') && (arrDataType[j] == "Currency"))
strfieldValue = currency(strfieldValue,grDet.CurrencySep,grDet.digitsAfterDec);
if ((arrControlType[j]=="")||((colsFreezed>0)&&(bnGridLoop==true)) && !((arrControlType[j]=="Image") || (arrControlType[j]=="Hyperlink"))) {
if (arrMulti[j]=="1") strRowHTML += '<SPAN Name="' + arrName[j]+strName + '" id="' +strName+ i + '" style="OVERFLOW:hidden; height:'+(grDet.RowHeight-10)+strUnit+'" onclick="IncRowHeight(this,false,\''+grDet.RowHeight+'\',\''+strUnit+'\','+ i + ',' + grDet.RowMaxHeight + ',\'' + grDet.Name + '\','+grDet.FreezeColumns+');"> ';
strRowHTML += strfieldValue;
if (arrMulti[j]=="1") strRowHTML += '</SPAN>';
}
else if (arrControlType[j]=="Image") {
strRowHTML += '<IMG Name="' + arrName[j]+strName + '" id="' +strName+ i + '" ALT="' + strToolTip + '" Title="' + strToolTip + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
if (grDet.Columns[j].ConditionalFormattingExists == true)
strRowHTML += ApplyConditionalFormatting("I", strfieldValue,arrDataType[j],grDet.Columns[j].ConditionalFormattings,RowList[i],grDet.DataFromAttrib)
else strRowHTML += 'SRC="' + grDet.Columns[j].ImageURL + '" ';
strRowHTML += '/>'+'<p style="display:none">'+strfieldValue+'</p>';
}
else if (arrControlType[j]=="Hyperlink") {
strRowHTML += '<A ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="'+strName + i + '" ';
strRowHTML += 'href="'+HREF_VALUE+'" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j];
strRowHTML += '>'+strfieldValue+'</A>';
}
else if ((arrControlType[j]=="InputBox") || ((arrControlType[j]=="DropDown") && (arrKeyField[j]=='Y'))) {
if (arrMulti[j]=="1") {
strRowHTML += '<TEXTAREA style="overflow:hidden; height:'+(grDet.RowHeight-5)+strUnit+'" onClick="IncRowHeight(this,true,\''+grDet.RowHeight+'\',\''+strUnit+'\',' + i + ',' + grDet.RowMaxHeight + ',\'' + grDet.Name + '\','+grDet.FreezeColumns+');" '; }
else{
strRowHTML += '<INPUT Type="Text" ';
}
strRowHTML += 'Name="' + arrName[j]+strName+ '" ID="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
if ((arrDataType[j] == "String") && (arrKeyField[j]=='N')) strRowHTML += 'Value="' + replaceQuotes(strfieldValue) + '" ';
else strRowHTML += 'Value="' + strfieldValue + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
strRowHTML += ' Style="width:' + arrControlWidth[j] + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
if (arrMaxLength[j]!=null) {
if ((arrDataType[j]=='Number') || (arrDataType[j]=='Amount')) {
if (arrMaxLength[j].indexOf(',') > 0) strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
else strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',0,\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
}
else {
if (arrKeyField[j]=='Y')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'S\');" ';
else {
if (arrCase[j]=='U')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'\');" ';
else
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'\',\'\');" ';
}
}
}
strRowHTML += arrAdditionalAttr[j];
if (arrMulti[j]=="1")
strRowHTML += '>' + strfieldValue + '</TEXTAREA>';
else
strRowHTML += '/>';
}
else if ((arrControlType[j]=="CheckBox") || (arrControlType[j]=="Radio")){
var strType;
var strCtrl;
if (arrControlType[j]=="CheckBox") { strType="CheckBox"; strCtrl="chk"; }
else { strType="Radio"; strCtrl="rad"; }
strRowHTML += '<INPUT Type="' + strType + '" Name="' + strCtrl + '_' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" _Checked="' + strfieldValue + '" ';
if ((strfieldValue=='Y') || (strfieldValue=='true')) strRowHTML += 'CHECKED ';
strRowHTML += ' Style="width=' + CHECKBOX_WIDTH + strUnit + ';" ';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
strRowHTML += ' onclick="GridCheckBox_Clicked(this); ' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';
strRowHTML += '<Input Type="Hidden" Name="' + arrName[j] + '" id="' + i + '" Value="' + strfieldValue + '" />';
}
else if (arrControlType[j]=="Button") {
strRowHTML += '<INPUT Type="Button" Name="' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" Style="width:' + arrControlWidth[j] + strUnit + ';text-align:' + arrAlignment[j] + ';" ';
if ((arrOnClickEvent[j]!='') || (arrOnClickEvent[j]!=null)) strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + 'Value="' + strfieldValue + '" />';
}//inserted for file by virsing
else if (arrControlType[j]=="file") {
strRowHTML += '<INPUT Type="file" Name="' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" Style="width:' + arrControlWidth[j] + strUnit + ';text-align:' + arrAlignment[j] + ';" ';
if ((arrOnClickEvent[j]!='') || (arrOnClickEvent[j]!=null)) strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + 'Value="' + strfieldValue + '" />';
}
//
else if (arrControlType[j]=="DropDown") {
strRowHTML += '<SELECT ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="' + strName+i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Readonly="true" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += ' Style="width:' + arrControlWidth[j] + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '>';
var strValue='Value="' + strfieldValue + '"';
var strComboValues=grDet.Columns[j].ComboValues;
strRowHTML += strComboValues.replace(strValue, strValue + ' SELECTED');
strRowHTML += '</SELECT>';
}
else if (arrControlType[j]=="InputSearch") {
strRowHTML += '<INPUT Type="Text" ';
strRowHTML += 'Name="' + arrName[j] +strName+ '" ';
strRowHTML += 'id="'+strName+ i + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += 'Value="' + strfieldValue + '" ';
if (arrMaxLength[j]!=null) {
if ((arrDataType[j]=='Number') || (arrDataType[j]=='Amount')) {
if (arrMaxLength[j].indexOf(',') > 0) strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
else strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',0,\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
}
else {
if (arrKeyField[j]=='Y')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'S\');" ';
else {
if (arrCase[j]=='U')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'\');" ';
else
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'\',\'\');" ';
}
}
}
strRowHTML += ' Style="width:' + eval(arrControlWidth[j] + '-' + SEARCH_BUTTON_WIDTH) + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';
strRowHTML += '<INPUT Type="Button" ';
strRowHTML += 'Name="btn' + arrName[j] + '" ';
strRowHTML += 'Class="Grid_SearchButton" ';
strRowHTML += 'Style="Width:' + SEARCH_BUTTON_WIDTH + '; Height:' + SEARCH_BUTTON_HEIGHT + ';"';
strRowHTML += 'id="' + i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Disabled="true" ';
strRowHTML += 'Value="..." ';
strRowHTML += ' onclick="' + grDet.Columns[j].SearchButtonClick + '" />';
}
else if (arrControlType[j]=="DatePicker") {
strRowHTML += '<INPUT Type="Text" ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="'+strName+ i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += 'Value="' + strfieldValue + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
if (arrMaxLength[j]!=null) strRowHTML += ' MaxLength="' + arrMaxLength[j] + '" ';
strRowHTML += ' Style="width:' + eval(arrControlWidth[j] + '-' + SEARCH_BUTTON_WIDTH) + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
strRowHTML += ' onkeypress="checkDate(this, event,\'' + grDet.DateFormat + '\',\''+grDet.DateSeperator+'\');" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';;
strRowHTML += '<INPUT Type="Button" Name="btn' + arrName[j] + '" ';
strRowHTML += 'Style="Width:' + SEARCH_BUTTON_WIDTH + '; Height:' + SEARCH_BUTTON_HEIGHT + ';"';
strRowHTML += 'class="Grid_DatePickerButton" id="' + i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Disabled="true" ';
strRowHTML += 'Value="6" onclick="ShowCalender(this);" />';
}
else{
if ((strfieldValue==null) || (strfieldValue==''))
strfieldValue=' ';
if (arrDataType[j] == "Currency")
strRowHTML += currency(strfieldValue,grDet.CurrencySep,grDet.digitsAfterDec);
else
strRowHTML += strfieldValue;
}
if(strConForm!='') strRowHTML+='</p>';
strRowHTML += '</TD>';
}
strRowHTML += '</TR>';
sRet += strRowHTML;
}
sRet += '</TABLE>';
return(sRet);
}
function CreateGrid(GridID, DataID, ContainerID, GridTag, DataRootTag, DataRowTag){
var objGrid;
var grdH=0;
if (GridID.tagName==GridTag)
objGrid=GridID;
else
objGrid=GridID.getElementsByTagName(GridTag)[0];
if (objGrid == null) return;
var grDet=new DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag);
ContainerID.style.width=grDet.Width + grDet.UnitDesignator;
ContainerID.style.height=grDet.Height + grDet.UnitDesignator;
ContainerID.className=grDet.GridContainerStyle;
var strGridHTML="";
var strGridCaptionHTML="";
var strGridColHTML="";
var strGridRowHTML="";
var strGridFooterHTML="";
var colsFreezed=parseInt(grDet.FreezeColumns);
var strUnit = grDet.UnitDesignator;
if (grDet.Caption!="") strGridCaptionHTML +=getGridCaption(grDet);
var RowList=DataID.getElementsByTagName(DataRowTag);
nRowList=RowList.length;
if (grDet.ColumnHeaders!="") strGridColHTML = getGridColumnHeaders(GridID,grDet);
var strName='';
var iLoop=1;
var strReturn='';
var gridWidth=grDet.Width;
if((colsFreezed>0)&&(nRowList>0)) {
iLoop=2; strName="";
strReturn='<table border="0" cellspacing="0" cellpadding="0"><tr><td>';
strGridRowHTML += strReturn;
}
grdH=grDet.Height;
if((grDet.AllowAddNew=="1")||(grDet.AllowDelete=="1" && grDet.HideDeleteButton=="0")||(grDet.AllowRowMoving=="1")||(grDet.AllowPaging=="1")||(grDet.AllowShowMore!="0") || (grDet.AllowExcelExport=="1") || (grDet.AllowPrintPriview=="1")) grdH-=25;
for(var k=0;k<iLoop;k++) {
if((colsFreezed>0) && (k<=0)){
gridWidth=getGridWidth(grDet,colsFreezed-2);
bnGridLoop=true;
strName="1";
}
if((k>0)&&(colsFreezed>0)) {
strName="";
strGridRowHTML+="</td><td>";
gridWidth=(toNumber(grDet.Width)- getGridWidth(grDet,colsFreezed-2));
bnGridLoop=false;
}
strGridRowHTML += '<DIV id="' + grDet.Name + '_Div_Rows'+strName+'" class="Grid_DetailDIV'+strName+'" ';
if((colsFreezed>0) && (k<=0)){
strGridRowHTML += 'style="overflow-x:hidden; overflow-y:hidden;';
}
else {
//strGridRowHTML += 'style="overflow-x:' + grDet.ScrollbarX + '; overflow-y:' + grDet.ScrollbarY +';';
if(grDet.ShowSummary=="1")
strGridRowHTML += 'style="overflow-x:hidden; overflow-y:' + grDet.ScrollbarY +';';
else
strGridRowHTML += 'style="overflow-x:' + grDet.ScrollbarX + '; overflow-y:' + grDet.ScrollbarY +';';
}
strGridRowHTML += ' height:' + grdH + strUnit + '; width=' + gridWidth + strUnit + ';" ';
if (grDet.ColumnHeaders=='1') {
if(colsFreezed>0)
strGridRowHTML += ' onscroll="ScrollHeader(' + grDet.Name + '_Div_Rows,' + grDet.Name + '_Div_Columns,' + grDet.Name + '_Div_Rows1,'+grDet.Name + '_Div_Col_Totals,'+grDet.FreezeColumns+','+grDet.ShowSummary+');" ';
else
strGridRowHTML += ' onscroll="ScrollHeader(' + grDet.Name + '_Div_Rows,' + grDet.Name + '_Div_Columns,\'\','+grDet.Name + '_Div_Col_Totals,'+grDet.FreezeColumns+','+grDet.ShowSummary+');" ';
}
strGridRowHTML += '>';
strGridRowHTML += getGridRows(grDet,RowList);
strGridRowHTML += '</DIV>';
if(colsFreezed<=0) break;
}
if((colsFreezed>0)&&(nRowList>0)) strGridRowHTML+='</td></tr></table>';
strGridRowHTML+=getGridTotalColumns(grDet);
//strGridRowHTML += '</TD></TR>'; //Nilesh - commented existing
if ((grDet.AllowAddNew=="1") || (grDet.AllowDelete=="1" && grDet.HideDeleteButton=="0") || (grDet.AllowRowMoving=="1") || (grDet.AllowPaging=="1") ||(grDet.AllowZoom=="1")|| (grDet.AllowShowMore!="0")||(grDet.AllowExcelExport=="1")||(grDet.AllowPrintPreview=="1")||(grDet.AllowPrint=="1") ) {
var intTotalRows=RowList.length;
strGridFooterHTML=getGridFooter(GridID, grDet, ContainerID.id,intTotalRows, GridTag, DataRootTag, DataRowTag);
}
strGridHTML += strGridCaptionHTML;
if (grDet.ColumnHeaders=="1") strGridHTML += strGridColHTML;
strGridHTML += strGridRowHTML;
strGridHTML += strGridFooterHTML;
ContainerID.innerHTML=strGridHTML;
if(nRowList>0)
setAllColTotals(grDet);
}
function DrawGrid(GridID, DataID, ContainerID) {
CreateGrid(GridID, DataID, ContainerID,"Grid","DataRows","row");
}
function DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag) {
this.AllowAddNew = getAttributeValue(objGrid,"AllowAddNew","0");
this.AllowDelete = getAttributeValue(objGrid,"AllowDelete","0");
this.AllowSort = getAttributeValue(objGrid,"AllowSort","1");
this.UnitDesignator = getAttributeValue(objGrid,"UnitDesignator","px");
this.ScrollbarX = getAttributeValue(objGrid,"Scrollbar-x","scroll");
this.ScrollbarY = getAttributeValue(objGrid,"Scrollbar-y","scroll");
this.AllowRowMoving = getAttributeValue(objGrid,"AllowRowMoving","0");
this.AllowZoom = getAttributeValue(objGrid,"AllowZoom","0");
this.ZoomValue=100;
this.Caption = getAttributeValue(objGrid,"Caption","");
this.CaptionStyle = getAttributeValue(objGrid,"CaptionStyle","Grid_CaptionClass");
this.CaptionAlignment = getAttributeValue(objGrid,"CaptionAlignment","Left");
this.ColumnHeaders = getAttributeValue(objGrid,"ColumnHeaders","1");
this.RowNumbers = getAttributeValue(objGrid,"RowNumbers","1");
this.RowNumberColWidth = getAttributeValue(objGrid,"RowNumberColWidth","22");
this.RowSelectorColWidth = getAttributeValue(objGrid,"RowSelectorColWidth","22");
this.Name = getAttributeValue(objGrid,"Name",objGrid.id + "_Grid");
this.Height = getAttributeValue(objGrid,"Height",GRID_HEIGHT);
var intWidth = getAttributeValue(objGrid,"Width",GRID_WIDTH);
if(BASE_RESOLUTION<=800){
intWidth=toNumber(intWidth);
if (screen.width>800) this.Width=Math.round(intWidth * 1.3) + "";
else this.Width=intWidth + "";
}
else
this.Width=intWidth+"";
this.RowHeight = getAttributeValue(objGrid,"RowHeight",ROW_HEIGHT);
this.ColHeaderHeight = getAttributeValue(objGrid,"ColHeaderHeight",COL_HEADER_HEIGHT);
this.OddRowStyle = getAttributeValue(objGrid,"OddRowStyle","Grid_OddRowStyle");
this.EvenRowStyle = getAttributeValue(objGrid,"EvenRowStyle","Grid_EvenRowStyle");
this.ActiveRowStyle = getAttributeValue(objGrid,"ActiveRowStyle","Grid_ActiveRowStyle");
this.AllowPaging = getAttributeValue(objGrid,"AllowPaging","0");
this.AllowColResize = getAttributeValue(objGrid,"AllowColResize","0");
this.NewRowStyle = getAttributeValue(objGrid,"NewRowStyle","Grid_NewRowStyle");
this.DeleteRowStyle = getAttributeValue(objGrid,"DeleteRowStyle","Grid_DeleteRowStyle");
this.DateFormat = getAttributeValue(objGrid,"DateFormat",DATE_FORMAT);
DATE_FORMAT=this.DateFormat;
this.PrevPageClick = getAttributeValue(objGrid,"PrevPageClick","");
this.NextPageClick = getAttributeValue(objGrid,"NextPageClick","");
this.BeforeAddNew = getAttributeValue(objGrid,"BeforeAddNew","");
this.AfterDelete= getAttributeValue(objGrid,"AfterDelete","");
this.DecimalSep = getAttributeValue(objGrid,"DecimalSeperator",DECIMAL_SEPERATOR);
this.GridContainerStyle = getAttributeValue(objGrid,"GridContainerStyle","Grid_ContainerClass");
this.ApplyActiveRowStyle = getAttributeValue(objGrid,"ApplyActiveRowStyle","1");
this.CurrencySep = getAttributeValue(objGrid,"CurrencySeperator",CURRENCY_SEPERATOR);
this.digitsAfterDec = getAttributeValue(objGrid,"DigitsAfterDecimal",DIGITS_AFTER_DECIMAL);
this.ImageURL = getAttributeValue(objGrid,"ImageURL","");
this.HideDeleteButton = getAttributeValue(objGrid,"HideDeleteButton","0");
this.FreezeColumns = getAttributeValue(objGrid,"FreezeColumns","0");
this.AllowShowMore = getAttributeValue(objGrid,"AllowShowMore","0");
this.SubHeaders = getAttributeValue(objGrid,"SubHeaders","0");
this.CollapseColumns = getAttributeValue(objGrid,"CollapseColumns","0");
this.SmartTip = getAttributeValue(objGrid,"SmartTip","0");
this.RowMaxHeight=getAttributeValue(objGrid,"RowMaxHeight",ROW_HEIGHT);
this.AllowCollapseAdd=getAttributeValue(objGrid,"AllowCollapseAdd","0");
this.ShowSummary=getAttributeValue(objGrid,"ShowSummary","0");
this.SummaryRows=getAttributeValue(objGrid,"SummaryRows","1");
this.AfterAddNew=getAttributeValue(objGrid,"AfterAddNew","");
this.DateSeperator=getAttributeValue(objGrid,"DateSeperator",DATE_SEPERATOR);
this.DataFromAttrib=getAttributeValue(objGrid,"DataFromAttribute","0");
this.DocObject=eval(getAttributeValue(objGrid,"DocumentObj",document));
this.OvRidAdRw=getAttributeValue(objGrid,"OverRideAddRow","");
function ReportParam(objNode) {
this.Caption=getAttributeValue(objNode,"Caption","");
this.Value= getAttributeValue(objNode,"Value","");
}
function ConditionalFormatting(Operator,Value1,Value2,SuccessStyle,vCompareField,vCompareType){
this.strOperator=Operator;
this.strValue1=Value1;
this.strValue2=Value2;
this.strSuccessStyle=SuccessStyle;
this.strCompareField=vCompareField;
this.strCompareType=vCompareType;
}
function GridColumn(objColumnNode) {
this.Name=getAttributeValue(objColumnNode,"Name","");
this.Width=getAttributeValue(objColumnNode,"Width",COL_WIDTH);
this.Caption=getAttributeValue(objColumnNode,"Caption","");
this.CaptionAlignment= getAttributeValue(objColumnNode,"CaptionAlignment","center");
this.DataField= getAttributeValue(objColumnNode,"DataField","");
this.DataType= getAttributeValue(objColumnNode,"DataType","String");
this.HeaderCaption=getAttributeValue(objColumnNode,"HeaderCaption","");
this.MultiLine = getAttributeValue(objColumnNode,"MultiLine","0");
this.ToolTipField = getAttributeValue(objColumnNode,"ToolTipField","");
this.Alignment= getAttributeValue(objColumnNode,"Alignment","");
if ((this.Alignment==null) || (this.Alignment=='')){
switch(this.DataType) {
case "String":
this.Alignment="Left"; break;
case "Number":
this.Alignment="Right"; break;
case "Currency":
this.Alignment="Right"; break;
case "Date":
this.Alignment="Left"; break;
}
}
this.DefaultValue=getAttributeValue(objColumnNode,"DefaultValue","");
this.ControlType=getAttributeValue(objColumnNode,"ControlType","");
this.Case=getAttributeValue(objColumnNode,"Case","");
if ((this.ControlType=="CheckBox") && (this.DefaultValue=="")) this.DefaultValue="N";
this.ControlStyle=getAttributeValue(objColumnNode,"ControlStyle","");
this.ControlStyleMand=getAttributeValue(objColumnNode,"MandControlStyle","");
if ((this.ControlStyle==null) || (this.ControlStyle=="")) {
if ((this.ControlType=="InputBox")||(this.ControlType=="InputSearch")||(this.ControlType=="DatePicker")) {
this.ControlStyle='Grid_InputBoxStyle';
this.ControlStyleMand='Grid_InputBoxMandStyle';
}else if (this.ControlType=="DropDown") {
this.ControlStyle='Grid_DropDownStyle';
this.ControlStyleMand='Grid_DropDownMandStyle';
}else if (this.ControlType=="Button")
this.ControlStyle='Grid_ButtonStyle';
else if (this.ControlType=="CheckBox") {
this.ControlStyle='Grid_CheckBoxStyle';
this.ControlStyleMand='Grid_CheckBoxMandStyle';
}
else if (this.ControlType=="Hyperlink")
this.ControlStyle='Grid_HyperLink';
}
this.ControlWidth = getAttributeValue(objColumnNode,"ControlWidth","");
this.AdditionalAttributes = getAttributeValue(objColumnNode,"AdditionalAttributes","");
this.MaxLength = getAttributeValue(objColumnNode,"MaxLength",null);
this.SearchButtonClick = getAttributeValue(objColumnNode,"SearchButtonClick","");
this.KeyField = getAttributeValue(objColumnNode,"Key","N");
this.Hidden = getAttributeValue(objColumnNode,"Hidden","N");
this.XMLDataIslandID = getAttributeValue(objColumnNode,"XMLDataIslandID","");
this.Mandatory = getAttributeValue(objColumnNode,"Mandatory","N");
this.Readonly = getAttributeValue(objColumnNode,"Readonly","N");
this.AllowNegative = getAttributeValue(objColumnNode,"AllowNegative","0");
this.OnChangeEvent = getAttributeValue(objColumnNode,"OnChangeEvent","");
this.OnClickEvent = getAttributeValue(objColumnNode,"OnClickEvent","");
this.OnDblClickEvent = getAttributeValue(objColumnNode,"OnDblClickEvent","");
this.HeaderCheckBox = getAttributeValue(objColumnNode,"HeaderCheckBox","0");
this.OnHCheckboxClick=getAttributeValue(objColumnNode,"OnHCheckboxClick","");
this.ImageURL = getAttributeValue(objColumnNode,"ImageURL","");
var arrColConditionalFormats;
var lstCondFormattings =objColumnNode.getElementsByTagName("ConditionalFormattings");
var blnColConditionalFormatExists=false;
try{
blnColConditionalFormatExists=(lstCondFormattings.length>0);
}
catch(e){
blnColConditionalFormatExists=false;
}
if (blnColConditionalFormatExists==true){
if (lstCondFormattings[0]!=null) {
var lstCondFormatting=lstCondFormattings[0].getElementsByTagName("ConditionalFormatting");
arrColConditionalFormats=new Array(lstCondFormatting.length);
for(var x=0;x<lstCondFormatting.length;x++) {
var strCFOperator=getAttributeValue(lstCondFormatting[x],"Operator","");
var strCFValue1=getAttributeValue(lstCondFormatting[x],"Value1","");
var strCFValue2=getAttributeValue(lstCondFormatting[x],"Value2","");
var strCFSuccessStyle=getAttributeValue(lstCondFormatting[x],"SuccessStyle","");
var strCompareField=getAttributeValue(lstCondFormatting[x],"CompareField","");
var strCompareType=getAttributeValue(lstCondFormatting[x],"CompareType","");
arrColConditionalFormats[x]=new ConditionalFormatting(strCFOperator, strCFValue1 , strCFValue2 , strCFSuccessStyle,strCompareField,strCompareType);
}
}
}
this.ConditionalFormattingExists=blnColConditionalFormatExists;
this.ConditionalFormattings=arrColConditionalFormats;
if (this.ControlType=="DropDown") this.ComboValues = GetComboValues(objColumnNode, this.XMLDataIslandID, GridTag, DataRootTag, DataRowTag) + '';
else this.ComboValues='';
//Nilesh - Summary
var isSum=getAttributeValue(objColumnNode,"Sum","0");
isSum+=','+getAttributeValue(objColumnNode,"Avg","0");
isSum+=','+getAttributeValue(objColumnNode,"Count","0");
isSum+=','+getAttributeValue(objColumnNode,"Min","0");
isSum+=','+getAttributeValue(objColumnNode,"Max","0");
this.ColumnSummary=isSum;
}
var CollList=objGrid.getElementsByTagName("Column");
if (CollList == null) return;
var intTotalColumns = CollList.length;
var arrColumns = new Array(intTotalColumns);
for (var i=0;i <intTotalColumns; i++)
arrColumns[i] = new GridColumn(CollList[i]);
this.Columns = arrColumns;
this.AllowExcelExport = getAttributeValue(objGrid,"AllowExcelExport","0");
this.AllowPrintPreview = getAttributeValue(objGrid,"AllowPrintPreview","0");
this.AllowPrint = getAttributeValue(objGrid,"AllowPrint","0");
//if ((this.AllowExcelExport=='1') || (this.AllowPrintPreview=='1') || (this.AllowPrint=='1')) {
this.ReportTitle = getAttributeValue(objGrid,"ReportTitle","");
this.HeaderLeft = getAttributeValue(objGrid,"HeaderLeft","");
this.HeaderCenter = getAttributeValue(objGrid,"HeaderCenter","");
this.HeaderRight = getAttributeValue(objGrid,"HeaderRight","");
this.FooterLeft = getAttributeValue(objGrid,"FooterLeft","");
this.FooterCenter = getAttributeValue(objGrid,"FooterCenter","");
this.FooterRight = getAttributeValue(objGrid,"FooterRight","");
this.PaperOrientation = getAttributeValue(objGrid,"PaperOrientation","P");
var objRptPrmSect = objGrid.getElementsByTagName("ReportParamSection");
if (null!=objRptPrmSect) {
if (objRptPrmSect.length>0) {
objRptPrmSect = objRptPrmSect[0];
var intTotColumns = getAttributeValue(objRptPrmSect,"NoOfColumns","1");
this.DisplayColumns = intTotColumns;
var arrRptParams = objRptPrmSect.getElementsByTagName("Param");
var intTotParams = arrRptParams.length;
var arrParams = new Array(intTotParams);
for (var i=0;i<intTotParams;i++)
arrParams[i] = new ReportParam(arrRptParams[i]);
this.TotalReportParams = intTotParams;
this.ReportParams = arrParams;
}
}
else
this.TotalReportParams=0;
//}
}
function getAttributeValue(p_nodeobj, p_AName, p_Default){
var tempvalue=p_nodeobj.getAttribute(p_AName);
if (tempvalue==null) tempvalue=p_Default;
return(tempvalue);
}
function getFieldValue(dataRow,strFieldName) {
var element=dataRow.selectSingleNode(strFieldName);
if (element==null) return('');
else return(element.text);
}
function getComboElements(objElement, columnTAG, objColumn, ComboDataIsland, GridTag, DataRootTag, DataRowTag) {
var objRows;
if (ComboDataIsland=='') {
var cmbItems=columnTAG.getElementsByTagName("Item");
var strOptions='';
for (var Index=0;Index<cmbItems.length;Index++) {
var strSelected;
var strValue=cmbItems[Index].getAttribute('Value');
if (objColumn.DefaultValue==strValue) strSelected='SELECTED';
else strSelected='';
strOptions = '<OPTION Value="' + strValue + '" ' + strSelected + ' ></OPTION>';
var tmpOptions=document.createElement(strOptions);
tmpOptions.appendChild(document.createTextNode(cmbItems[Index].text));
objElement.appendChild(tmpOptions);
}
return(objElement);
}
else {
var objComboData=document.getElementById(ComboDataIsland);
if ((objComboData==null) || (objComboData.documentElement == undefined)){
objComboData = document.XMLDocument.documentElement.selectSingleNode(ComboDataIsland);
if (objComboData==null) return '';
objRows=objComboData.getElementsByTagName(DataRowTag);
}
else {
var objGrid=objComboData.getElementsByTagName(GridTag)[0];
var objDataRows=objGrid.getElementsByTagName(DataRootTag)[0];
objRows=objDataRows.getElementsByTagName(DataRowTag);
}
var strOptions=''
for (var i=0;i<objRows.length;i++) {
var strSelected;
var strValue=objRows[i].childNodes.item(0).text;
if (objColumn.DefaultValue==strValue) strSelected='SELECTED';
else strSelected='';
strOptions = '<OPTION Value="' + strValue + '" ' + strSelected + ' ></OPTION>';
var tmpOptions=document.createElement(strOptions);
tmpOptions.appendChild(document.createTextNode(objRows[i].childNodes.item(1).text));
objElement.appendChild(tmpOptions);
}
return(objElement);
}
}
function CreatePage(GridID, DataID, ContainerID, GridTag, DataRootTag, DataRowTag){
var objGrid=GridID.getElementsByTagName(GridTag)[0];
if (objGrid == null) return;
var grDet=new DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag);
var strGridRowHTML="";
var RowList=DataID.getElementsByTagName(DataRowTag);
var GridRowContainer;
var arrDivTags=ContainerID.getElementsByTagName('DIV');
var iLoop=1;
var strName='';
var colsFreezed=parseInt(grDet.FreezeColumns);
if(colsFreezed>0)iLoop=2;
for(var k=0;k<iLoop;k++) {
bnGridLoop=false;
strName="";
if((k<=0) && (iLoop==2)) { bnGridLoop=true; strName="1"; }
strGridRowHTML = getGridRows(grDet,RowList);
for (var i=0;i <arrDivTags.length;i++) {
if (arrDivTags[i].id==grDet.Name+'_Div_Rows'+strName) {
GridRowContainer=arrDivTags[i];
break; }
}
if (GridRowContainer!=null) GridRowContainer.innerHTML=strGridRowHTML;
}
}
function DisplayPage(GridID, DataID, ContainerID) {
CreatePage(GridID, DataID, ContainerID, "Grid", "DataRows", "row")
}
function ApplyConditionalFormatting(strType, strCellValue, varStrDataType, arrFormattings,rowList) {
var strResult='';
if (strType!='I') strResult='<P';
var vntActualValue;
var strDataType='';
var vCmpFld='';
var vCmpValue='';
var Value1;
var Value2;
var cmpField;
strDataType=varStrDataType;
for(var intIndex=0;intIndex<arrFormattings.length;intIndex++) {
vCmpFld=arrFormattings[intIndex].strCompareField; //Nilesh
if (strType=='C') strDataType=arrFormattings[intIndex].strCompareType; //Nilesh
if ((vCmpFld!=null)&&(vCmpFld!='')) {
vCmpValue=getFieldValue(rowList,vCmpFld);
strDataType=arrFormattings[intIndex].strCompareType;
}
else {
vCmpValue=strCellValue;
}
if ((strDataType=='Number') || (strDataType=='Currency')) {
vntActualValue=vCmpValue;//strCellValue;
Value1=toNumber(arrFormattings[intIndex].strValue1);
if (arrFormattings[intIndex].strValue2!=null) Value2=toNumber(arrFormattings[intIndex].strValue2);
}
else if (strDataType=='String') {
vntActualValue='\'' + vCmpValue + '\'';//'\'' + strCellValue + '\'';
Value1='\'' + arrFormattings[intIndex].strValue1 + '\'';
if (arrFormattings[intIndex].strValue2!=null) Value2='\'' + arrFormattings[intIndex].strValue2 + '\'';
}
else if (strDataType=='Date') {
vntActualValue='getDateFromFormat(\'' + vCmpValue + '\')'; //'getDateFromFormat(\'' + strCellValue + '\')';
Value1='getDateFromFormat(\'' + arrFormattings[intIndex].strValue1 + '\')';
if (arrFormattings[intIndex].strValue2!=null) Value2='getDateFromFormat(\'' + arrFormattings[intIndex].strValue2 + '\')';
}
var blnRetValue=false;
var strexp='';
switch(arrFormattings[intIndex].strOperator) {
case 'LT':
strexp=vntActualValue + ' < ' + Value1; break;
case 'GT':
strexp=vntActualValue + ' > ' + Value1; break;
case 'EQ':
strexp=vntActualValue + ' == ' + Value1; break;
case 'LTEQ':
strexp=vntActualValue + ' <= ' + Value1; break;
case 'GTEQ':
strexp=vntActualValue + ' >= ' + Value1; break;
case 'NOTEQ':
strexp=vntActualValue + ' != ' + Value1; break;
case 'BET':
strexp='((' + vntActualValue + ' >= ' + Value1 + ') && ( ' + vntActualValue + ' <= ' + Value2 + '))'; break;
case 'NOTBET':
strexp='(!((' + vntActualValue + ' >= ' + Value1 + ') && ( ' + vntActualValue + ' <= ' + Value2 + ')))'; break;
}
if (strexp != null) {
blnRetValue=eval(strexp);
if (blnRetValue==true) {
if (strType=='I') strResult= ' SRC="' + arrFormattings[intIndex].strSuccessStyle + '"';
else strResult+= ' class="' + arrFormattings[intIndex].strSuccessStyle + '"';
break; }
}
}
if ((strType!='I')&&(strType!='C')) strResult+='>' + strCellValue + '</P>';
if(strType=='C') strResult+='>';
return(strResult);
}
function resetActiveRow(tlbDetail, actRow) {
if (actRow >= 0) {
var bod = tlbDetail.tBodies[0];
if (bod.rows[actRow]._Mode=="N")
applyRowStyle(tlbDetail, bod.rows[actRow], tlbDetail._NewRowStyle);
else if ((bod.rows[actRow]._Mode=="D") || (bod.rows[actRow]._Mode=="X"))
applyRowStyle(tlbDetail, bod.rows[actRow], tlbDetail._DeleteRowStyle);
else {
if (actRow%2==0) applyRowStyle(tlbDetail, bod.rows[actRow],tlbDetail._EvenRowStyle);
else applyRowStyle(tlbDetail, bod.rows[actRow],tlbDetail._OddRowStyle);
}
}
}
function setActiveRow(tlbDetail, prow, colsFreezed) {
var oldRow=parseInt(tlbDetail._ActiveRow);
var actRow=parseInt(prow.cells[0].innerText)-1;
tlbDetail._ActiveRow=actRow;
resetActiveRow(tlbDetail, oldRow);
applyRowStyle(tlbDetail, prow, tlbDetail._ActiveRowStyle);
if(colsFreezed>0){
var gName=Mid(tlbDetail.id,0,tlbDetail.id.indexOf("_Table_Rows"));
if(tlbDetail.id==gName+"_Table_Rows")
var tlbDetail2 = document.getElementById(gName+"_Table_Rows1");
else
var tlbDetail2 = document.getElementById(gName+"_Table_Rows");
resetActiveRow(tlbDetail2, oldRow);
applyRowStyle(tlbDetail2, tlbDetail2.rows[actRow], tlbDetail2._ActiveRowStyle);
}
}
function applyRowStyle(tlbDetail, pRow, newStyle) {
var startIndex=2;
if (pRow._Mode=="N")
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",tlbDetail._NewRowStyle,0);
else if ((pRow._Mode=="D") || (pRow._Mode=="X"))
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",tlbDetail._DeleteRowStyle,0);
else
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",newStyle,0);
}
function getGridColumnHeaders(GridID,grDet){
var sRet='';
var strTHead='';
var strGrp='';
var strNum='';
var strInnerText='';
var colsTag='';
var strScrollBarY='';
var gridWidth=grDet.Width;
var strUnit = grDet.UnitDesignator;
var returnStr='';
var i;
var colsToMerge=new Array();
var colsFreezed=0;
var lngRowTableWidth=getRowTableWidth(grDet);
if((grDet.FreezeColumns!="0")||(grDet.CollapseColumns=="1")) lngRowTableWidth="0";
if (grDet.ScrollbarY=='hidden') strScrollBarY='hidden';
else strScrollBarY=grDet.ScrollbarY;
if((grDet.FreezeColumns!="0") && (nRowList >0)) colsFreezed=parseInt(grDet.FreezeColumns);
if(colsFreezed>0) returnStr='<table cellspacing="0" colspacing="0" border="0"><tr><td>';
for(var k=0;k<2;k++)
{
if(colsFreezed<=0) strNum='';
if((k>0) && (colsFreezed>0)){
gridWidth=(parseInt(grDet.Width)- parseInt(getGridWidth(grDet,colsFreezed-2))-4)+"";
if(colsFreezed>0) returnStr+='</td><td>';
strScrollBarY=grDet.ScrollbarY;
strNum="";
}
else{
if(colsFreezed>0) { gridWidth=getGridWidth(grDet,colsFreezed-2) ; strNum="1"; strScrollBarY='hidden'; };
}
sRet = '<DIV ID="' + grDet.Name + '_Div_Columns'+strNum+'" class="Grid_HeaderDIV" ';
sRet += 'style="overflow-x:hidden; overflow-y:' + strScrollBarY + '; height=' + grDet.ColHeaderHeight + strUnit + '; width=' + gridWidth + strUnit + ';"> ';
sRet += '<TABLE ID="' + grDet.Name + '_Table_Headers'+strNum+'" border="0" width="' + lngRowTableWidth + strUnit + '" height="100%" cellpadding="0" cellspacing="0" style="table-layout:fixed;" >';
strTHead = '<THEAD>';
colsToMerge = new Array(grDet.Columns.length);
if(grDet.SubHeaders=="1") strGrp=getGridSubHeaders(GridID, grDet,k,colsToMerge);
strTHead += strGrp + '<TR>';
if(k>0){
colsTag='<COL width="1' + strUnit + '" style="display:none;">';
colsTag+='<COL width="1'+ strUnit + '" style="display:none;">';
}
else {
colsTag='<COL width="' + grDet.RowNumberColWidth + strUnit+'"';
if (grDet.RowNumbers == "0") colsTag+=' style="display:none;"';
colsTag+='>';
colsTag+='<COL width="' + grDet.RowSelectorColWidth + strUnit+'"';
if (!((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1"))) colsTag+=' style="display:none;"';
colsTag+='>';
}
if(grDet.SubHeaders!="1") { /*Nilesh - Check for subheaders for rowspan */
strTHead += '<TH width="' + grDet.RowNumberColWidth + strUnit + '" class="Grid_HeaderClass" ';
strTHead += ' id="' + grDet.Name + '"_Row_Number"> </TH>';
strTHead += '<TH width="' + grDet.RowSelectorColWidth + strUnit + '" align="center" class="Grid_CheckBoxHeaderColumn" ';
strTHead += ' id="' + grDet.Name + '"_Row_Selector"><INPUT Type="CheckBox" Name="' + grDet.Name + 'chkSelectAll'+strNum+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="doSelectAll(' + grDet.Name + 'chkSelectAll'+strNum+',' + grDet.Name + '_Table_Rows'+strNum+', \'' + grDet.DeleteRowStyle + '\',' + grDet.FreezeColumns + ');" ';
strTHead += ' /></TH>';
}
var strColWidth='';
var strStyle='';
var colsVisible=getVisibleCols(grDet);
for (i=0;i<grDet.Columns.length; i++){
strColWidth="0";
strStyle='';
if(k>0){
if(i<(colsFreezed-2)){ strColWidth ="1"; strStyle=' style="display:none;"';} }
else {
if(colsFreezed>0) { if(i>=(colsFreezed-2)) { strColWidth ="1"; strStyle=' style="display:none;"'; } } }
if((grDet.AllowShowMore!="0")&&(grDet.Columns[i].Hidden!='Y')) {
//if(i>=((parseInt(grDet.Columns.length)-parseInt(grDet.AllowShowMore))))
if (i>=(colsVisible-parseInt(grDet.AllowShowMore)))
strColWidth="1";
}
colsTag+='<COL id="'+strNum+'c'+grDet.Name+i+'" width="' + grDet.Columns[i].Width + strUnit+'" ';
if(grDet.Columns[i].Hidden=="Y"||strColWidth=="1") colsTag+=' style="display:none;"';
colsTag+=strStyle+'>';
if(colsToMerge[i]!="R") {
strTHead += '<TH id="head_' + grDet.Columns[i].Name + '" ColumnName="' + grDet.Columns[i].Name + '" width="' + grDet.Columns[i].Width + strUnit + '" ';
strTHead += ' DataType="' + grDet.Columns[i].DataType + '" ';
strTHead += ' _Position="' + ( i + 2) + '" _displayMode="E" ';
strTHead += ' Align="' + grDet.Columns[i].CaptionAlignment + '" ';
if (grDet.Columns[i].Mandatory=='Y') strTHead += 'class="Grid_HeaderMandClass" ';
else strTHead += 'class="Grid_HeaderClass" ';
strTHead += '>';
strInnerText='';
if ((grDet.CollapseColumns=="1") && (grDet.SubHeaders!="1")) {
if ((colsFreezed>0) && (k<1)) {
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="1" align="left"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-2) + strUnit + '"'
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
else
{
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="15" align="left"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value="" name="BtnExpand'+grDet.Name+i+'" title="Expand/Colapse columns" _Collapsed="E" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'E\');"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-30)+strUnit+'"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
}
else
{
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="1" align="left"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-2) + strUnit + '"'
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
if (grDet.Columns[i].HeaderCheckBox=='1') {
strTHead += '<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll,' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strTHead += grDet.Columns[i].OnHCheckboxClick;
strTHead += '" /> ';
}
strTHead += grDet.Columns[i].Caption;
if ((grDet.CollapseColumns=="1") && (grDet.SubHeaders!="1")) {
if((colsFreezed>0) && (k<1)) {
strInnerText = '</td><td width="1">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
else {
strInnerText = '</td><td width="15"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value=3 name="BtnCollapse'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'C\');">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
}
else {
strInnerText = '</td><td width="1">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
strTHead += '</TH>';
}
}
strTHead += '</TR></THEAD>';
sRet += colsTag+strTHead+'</TABLE></DIV>';
returnStr +=sRet;
if(colsFreezed<=0) break;
}
if(colsFreezed>0) returnStr+='</td><tr></table>';
sRet=returnStr;
return(sRet);
}
function getGridWidth(grDet, colsNum) {
var lngRowTableWidth=0;
if (grDet.RowNumbers == "1") lngRowTableWidth+=toNumber(grDet.RowNumberColWidth);
if ((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")) lngRowTableWidth+=toNumber(grDet.RowSelectorColWidth);
for (var i=0; i<colsNum;i++) {
if (grDet.Columns[i].Hidden!='Y') {
if (i==grDet.Columns.length-1) {
var intGridWidth=0;
lngRowTableWidth+=intGridWidth-lngRowTableWidth;
}
else
lngRowTableWidth+=toNumber(grDet.Columns[i].Width);
}
}
return(lngRowTableWidth);
}
function getGridSubHeaders(GridID, grDet,k, colsToMerge)
{
var sRet='';
var strTHead='';
var strInnerText='';
var strCol='';
var strNum='';
var grpWidth=0;
var iSortCol=0;
var colSpanned='';
var strUnit = grDet.UnitDesignator;
var lngRowTableWidth=0;
var colsFreezed=parseInt(grDet.FreezeColumns);
if((colsFreezed>0)&&(k<1))
strNum="1";
else
strNum="";
strTHead = '<TR><TH width="' + grDet.RowNumberColWidth + strUnit + '" class="Grid_HeaderClass" ';
strTHead += ' ID="' + grDet.Name + '"_Row_Number" rowspan="2"> </TH>';
strTHead += '<TH width="' + grDet.RowSelectorColWidth + strUnit + '" align="center" class="Grid_CheckBoxHeaderColumn" ';
strTHead += ' ID="' + grDet.Name + '"_Row_Selector" rowspan="2"><INPUT Type="CheckBox" Name="' + grDet.Name + 'chkSelectAll'+strNum+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="doSelectAll(' + grDet.Name + 'chkSelectAll'+strNum+',' + grDet.Name + '_Table_Rows'+strNum+', \'' + grDet.DeleteRowStyle + '\',' + grDet.FreezeColumns + ');" ';
strTHead += ' /></TH>';
colSpanned=1;
var currCaption='';
var curWidth=0;
var sortCol=0;
for(var i=0;i<grDet.Columns.length-1;i++) {
currCaption=grDet.Columns[i].HeaderCaption;
if(currCaption=='') currCaption=i+"";
curWidth = parseInt(grDet.Columns[i].Width);
if((currCaption==grDet.Columns[i+1].HeaderCaption) && (grDet.Columns[i].Hidden !='Y')){
colSpanned=colSpanned+1;
grpWidth += parseInt(curWidth);
}
if((currCaption!=grDet.Columns[i+1].HeaderCaption)){
if(colSpanned>1)
grpWidth += parseInt(curWidth);
else
grpWidth =parseInt(curWidth);
strCol = '<TH ColumnName="' + grDet.Columns[i].Name+'" width="'+ grpWidth + strUnit + '" ';
strCol += ' _Position="' + ( i + 2) + '" _displayMode="E" ';
strCol += ' Align="' + grDet.Columns[i].CaptionAlignment + '" ';
if (grDet.Columns[i].Mandatory=='Y') strCol += 'class="Grid_HeaderMandClass" ';
else strCol += ' class="Grid_HeaderCellClass" ';
strTHead += strCol;
if(colSpanned<=1) currCaption = grDet.Columns[i].Caption;
strInnerText='';
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grpWidth+'" _mode[]="E"><tr>';
if (grDet.CollapseColumns=="1") {
if ((colsFreezed>0) && (k<1)) {
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth) + strUnit + '"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,'+grDet.Name+'_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText +='>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll'+k+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll'+k+',' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
}
else {
strInnerText += '<td width="15" align="left"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value="" name="BtnExpand'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'E\');"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth-30) + strUnit + '" ';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText += '>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll,' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
strInnerText += '</td><td width="15"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value=3 name="BtnCollapse'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'C\');">'; }
}
else
{
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth) + strUnit + '"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,'+grDet.Name+'_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll'+k+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll'+k+',' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
}
strInnerText += '</td></tr></table>';
if(colSpanned
"grid.js"
var arrowUp,arrowDown;
var bnGridLoop=false;
var nRowList=0;
initSortTable();
function initSortTable() {
arrowUp = document.createElement("SPAN");
var tn = document.createTextNode("p");
arrowUp.appendChild(tn);
arrowUp.className = "Grid_arrow";
arrowDown = document.createElement("SPAN");
var tn = document.createTextNode("q");
arrowDown.appendChild(tn);
arrowDown.className = "Grid_arrow";
}
function getGridCaption(grDet){
var sRet='<TABLE ID="' + grDet.Name + '"_Table_Caption" border="0" width="100%" cellpadding="0" cellspacing="0">';
sRet += '<TR><TD ID="' + grDet.Name + '"_Grid_Caption" align="' + grDet.CaptionAlignment + '" class="' + grDet.CaptionStyle + '">';
sRet += grDet.Caption + '</TD></TR></TABLE>';
return(sRet);
}
function getRowTableWidth(grDet)
{
var lngRowTableWidth=0;
for (var i=0; i<grDet.Columns.length;i++) {
if (grDet.Columns[i].Hidden!='Y') {
if (i==grDet.Columns.length-1) {
var intGridWidth=toNumber(grDet.Width);
if ((lngRowTableWidth + toNumber(grDet.Columns[i].Width)) < intGridWidth) {
lngRowTableWidth+=intGridWidth-lngRowTableWidth;
if ((grDet.ScrollbarY=='scroll')||(grDet.ScrollbarY=='visible')) lngRowTableWidth-=17;
}
}
else {
lngRowTableWidth+=toNumber(grDet.Columns[i].Width);}
}
}
return(lngRowTableWidth);
}
function getGridFooter(GridID, grDet, ContainerID,TotalRows,GridTag, DataRootTag, DataRowTag){
var sRet='';
var strUnit = grDet.UnitDesignator;
sRet = '<DIV ID="' + grDet.Name + '_Div_Footer" class="Grid_FooterDIV" style="overflow:hidden;height=25' + strUnit + '; width=' + grDet.Width + strUnit + ';"> ';
sRet += '<TABLE ID="' + grDet.Name + '_Table_Footer" style="overflow:scroll; border="1" width="100%" height="100%" cellpadding="0" cellspacing="0">';
sRet += '<TR><TD class="Grid_FooterClass"><TABLE ID="' + grDet.Name + '_Table_Buttons" border="0" cellspacing="0"><TR>';
if (grDet.AllowAddNew=="1"){
sRet += '<TD><INPUT class="Grid_NewDeleteButtons" Name="' + grDet.Name + '_btnAdd" Type="Button" Value="+" Title="Add new row" onclick="';
if(grDet.OvRidAdRw!="") sRet += grDet.OvRidAdRw;
else sRet += 'addRow(\'' + GridID.id + '\',' + grDet.Name + '_Table_Rows,\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\');';
sRet += '" /></TD>';
}
if ((grDet.AllowDelete=="1") && (grDet.HideDeleteButton=="0"))
sRet += '<TD><INPUT class="Grid_NewDeleteButtons" Name="' + grDet.Name + '_btnDelete" Type="Button" Value="-" Title="Delete selected rows" onclick="deleteRow(' + grDet.Name + '_Table_Rows,' + grDet.Name +'chkSelectAll,\'' + grDet.AfterDelete + '\',\''+GridID.id+'\',' + grDet.FreezeColumns + ');" /></TD>';
if (grDet.AllowRowMoving=="1" && TotalRows > 0) {
sRet += '<TD><INPUT class="Grid_MoveUpDownButtons" Name="' + grDet.Name + '_btnUp" Type="Button" Value="5" Title="Move selected rows up" onclick="moveRow(' + grDet.Name + '_Table_Rows,' + grDet.Name + '_chkSelect[], -1,' + grDet.FreezeColumns + ');" /></TD>';
sRet += '<TD><INPUT class="Grid_MoveUpDownButtons" Name="' + grDet.Name + '_btnDown" Type="Button" Value="6" Title="Move selected rows down" onclick="moveRow(' + grDet.Name + '_Table_Rows,' + grDet.Name + '_chkSelect[], 1,' + grDet.FreezeColumns + ');" /></TD>';
}
if (grDet.AllowPaging=="1") {
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnPrev" Title="Previous Page" ID="btnPrev" Type="Button" Value="7" onclick="'+ grDet.PrevPageClick + '" /></TD>';
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnNext" Title="Next Page" ID="btnNext" Type="Button" Value="8" onclick="' + grDet.NextPageClick + '" /></TD>';
}
if (grDet.AllowZoom=="1") {
sRet += '<TD><INPUT Name="' + grDet.Name + '_ZoomValue" Type="Hidden" ID="' + grDet.Name + '_ZoomValue" Value="100">';
sRet += '<input type="image" src="' + IMG_ZOOM_IN + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnZoomIn" Title="Zoom In" ID="' + grDet.Name + '_btnZoomIn" onclick="return doZoom(\'' + ContainerID + '\',\'+\',' + grDet.Name + '_ZoomValue);" /></TD>';
sRet += '<TD><input type="image" src="' + IMG_ZOOM_OUT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnZoomOut" Title="Zoom Out" ID="' + grDet.Name + '_btnZoomIn" onclick="return doZoom(\'' + ContainerID + '\',\'-\',' + grDet.Name + '_ZoomValue);"/></TD>';
}
if (grDet.AllowShowMore!="0") {
sRet += '<TD><INPUT class="Grid_PageNextPrevButtons" Name="' + grDet.Name + '_btnMore" Type="Button" Value="4" Title="Show / Hide columns" onclick="ShowMoreColumns(\''+ GridID.id + '\',\''+grDet.Name+'\',this);" _bnClickMore="false"/></TD>';
}
if (grDet.AllowExcelExport=="1") sRet += '<TD><input type="image" src="' + IMG_EXPORT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnExport" Value="Export To Excel" Title="Export To Excel" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'EX\');" /></TD>';
if (grDet.AllowPrintPreview=="1") sRet += '<TD><input type="image" src="' + IMG_PREVIEW + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnPrintPreview" Value="Print Priview" Title="Print Priview" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'PP\');" /></TD>';
if (grDet.AllowPrint=="1") sRet += '<TD><input type="image" src="' + IMG_PRINT + '" class="Grid_ZoomButtons" Name="' + grDet.Name + '_btnPrint" Value="Print" Title="Print" onclick="return gridExportToExcel(\'' + GridID.id + '\',\'' + grDet.Name + '\',\'' + GridTag + '\',\'' + DataRootTag + '\',\'' + DataRowTag + '\',\'PO\');" /></TD>';
sRet += '</TABLE></TD></TR></TABLE></DIV>';
return(sRet);
}
function getGridRows(grDet, RowList) {
var sRet='';
var showMoreCol;
var strUnit = grDet.UnitDesignator;
var strConForm='';
var intTotalRows=RowList.length;
var lngRowTableWidth=getRowTableWidth(grDet);
if((grDet.FreezeColumns!="0")||(grDet.CollapseColumns=="1")) lngRowTableWidth="0";
var intTotalColumns=grDet.Columns.length;
var strName='';
var colsFreezed=parseInt(grDet.FreezeColumns);
var bnClickMore="false";
var objClickMore=document.getElementById(grDet.Name + "_btnMore");
if (objClickMore!=null) bnClickMore=objClickMore._bnClickMore;
if(grDet.FreezeColumns!="0"){
if(bnGridLoop==true) {
strName="1";//intTotalColumns = colsFreezed;
}
}
sRet += '<TABLE ID="' + grDet.Name + '_Table_Rows'+strName+'" border="0" width="' + lngRowTableWidth + strUnit + '" cellspacing="0" cellpading="0" _ActiveRow="-1" ' ;
if ((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")) sRet += ' _HasCheckBox="1" ';
else sRet += ' _HasCheckBox="0" ';
sRet += ' _HasRowNumbers="' + grDet.RowNumbers + '" ';
sRet += ' _ActiveRowStyle="' + grDet.ActiveRowStyle + '" ';
sRet += ' _OddRowStyle="' + grDet.OddRowStyle + '" ';
sRet += ' _EvenRowStyle="' + grDet.EvenRowStyle + '" ';
sRet += ' _NewRowStyle="' + grDet.NewRowStyle + '" ';
sRet += ' _DeleteRowStyle="' + grDet.DeleteRowStyle + '" ';
sRet += ' Style="table-layout:fixed;" >';
var strOddEvenStyle;
var arrName=new Array(intTotalColumns);
var arrDataType=new Array(intTotalColumns);
var arrWidth=new Array(intTotalColumns);
var arrCase=new Array(intTotalColumns);
var arrAlignment=new Array(intTotalColumns);
var arrControlStyle=new Array(intTotalColumns);
var arrControlStyleMand=new Array(intTotalColumns);
var arrControlType=new Array(intTotalColumns);
var arrControlWidth=new Array(intTotalColumns);
var arrKeyField=new Array(intTotalColumns);
var arrDataField=new Array(intTotalColumns);
var arrHidden=new Array(intTotalColumns);
var arrMaxLength=new Array(intTotalColumns);
var arrAdditionalAttr=new Array(intTotalColumns);
var arrMandatory=new Array(intTotalColumns);
var arrReadonly=new Array(intTotalColumns);
var arrAllowNegative=new Array(intTotalColumns);
var arrOnChangeEvent=new Array(intTotalColumns);
var arrOnClickEvent=new Array(intTotalColumns);
var arrOnDblClickEvent=new Array(intTotalColumns);
var arrDefaultValue=new Array(intTotalColumns);
var arrToolTip=new Array(intTotalColumns);
var arrMulti=new Array(intTotalColumns);
var arrColSum=new Array(intTotalColumns);
var arrShowCol=new Array(intTotalColumns);
var colsVisible=getVisibleCols(grDet);
var colsTag="";
if((grDet.AllowShowMore!="0")||(colsFreezed>0)) colsTag='<COL id="c1"><COL id="c2">';
for (var x=0;x<intTotalColumns;x++) {
arrName[x]=grDet.Columns[x].Name;
arrDataType[x]=grDet.Columns[x].DataType;
arrWidth[x]=grDet.Columns[x].Width;
if(grDet.AllowShowMore!="0" ||colsFreezed>0){
colsTag+='<COL id="c'+arrName[x]+'_rows'+strName+'" ';
if(colsFreezed>0){
if ((bnGridLoop==true) && (x>=(colsFreezed-2)))
arrWidth[x]="1";
if ((bnGridLoop==false) && (x<(colsFreezed-2)))
arrWidth[x]="1";
}
if(grDet.AllowShowMore!="0"){
if (x>=(colsVisible-parseInt(grDet.AllowShowMore)) && (bnClickMore=="false"))
colsTag+=' style="display:none;"';//arrShowCol[x]="0";
}
else if (grDet.Columns[x].Hidden=="Y"){
colsTag+=' style="display:none;"';//arrShowCol[x]="0";
}
colsTag+='>';
}
arrAlignment[x]=grDet.Columns[x].Alignment;
arrControlStyle[x]=grDet.Columns[x].ControlStyle;
arrControlStyleMand[x]=grDet.Columns[x].ControlStyleMand;
arrControlType[x]=grDet.Columns[x].ControlType;
arrControlWidth[x]=grDet.Columns[x].ControlWidth;
arrKeyField[x]=grDet.Columns[x].KeyField;
arrDataField[x]=grDet.Columns[x].DataField;
arrHidden[x]=grDet.Columns[x].Hidden;
arrMaxLength[x]=grDet.Columns[x].MaxLength;
arrAdditionalAttr[x]=grDet.Columns[x].AdditionalAttributes;
arrMandatory[x]=grDet.Columns[x].Mandatory;
arrCase[x]=grDet.Columns[x].Case;
arrReadonly[x]=grDet.Columns[x].Readonly;
arrAllowNegative[x]=grDet.Columns[x].AllowNegative;
arrOnChangeEvent[x]=grDet.Columns[x].OnChangeEvent;
arrOnClickEvent[x]=grDet.Columns[x].OnClickEvent;
arrOnDblClickEvent[x]=grDet.Columns[x].OnDblClickEvent;
arrDefaultValue[x]=grDet.Columns[x].DefaultValue;
arrToolTip[x]=grDet.Columns[x].ToolTipField;
arrMulti[x]=grDet.Columns[x].MultiLine;
arrColSum[x]=grDet.Columns[x].ColumnSummary;
}
sRet +=colsTag;
var strRowHTML='';
for (var i=0;i<intTotalRows; i++) {
if (i%2==0) strOddEvenStyle= grDet.EvenRowStyle;
else strOddEvenStyle= grDet.OddRowStyle;
strRowHTML = '<TR class="' + strOddEvenStyle + '" _oldClass="' + strOddEvenStyle + '" ';
strRowHTML += ' style="height:' + grDet.RowHeight + strUnit + ';" ';
if (grDet.ApplyActiveRowStyle=='1') strRowHTML += ' onclick="setActiveRow(' + grDet.Name + '_Table_Rows'+strName+',this,' + grDet.FreezeColumns + ');"';
strRowHTML += '" _Mode[]="B" >';
strRowHTML += '<TD width="';
if((colsFreezed>0)&&(bnGridLoop==false))
strRowHTML += "1";
else
strRowHTML +=grDet.RowNumberColWidth;
strRowHTML += strUnit + '" class="Grid_RowNumberClass" _oldClass="Grid_RowNumberClass" ';
if (grDet.RowNumbers!="1") strRowHTML += ' style="display:none;"';
strRowHTML += '>';
strRowHTML += (i + 1);
strRowHTML += '</TD>';
strRowHTML += '<TD width="';
if((colsFreezed>0)&&(bnGridLoop==false))
strRowHTML += "1";
else
strRowHTML +=grDet.RowSelectorColWidth;
strRowHTML += strUnit + '" align="center" ';
strRowHTML += ' height=' + grDet.RowHeight + strUnit + '" ';
strRowHTML += ' class="Grid_CheckBoxColumn" ';
if (!((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")))
strRowHTML += ' style="display:none;"';
strRowHTML += ' _oldClass="Grid_CheckBoxColumn" >';
strRowHTML += '<INPUT class="Grid_SelectCheckBox" Type="CheckBox" _Checked="N" Name="'+ grDet.Name + '_chkSelect[]'+strName+'" ID="' + i + '" ';
strRowHTML += ' Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
if((colsFreezed>0)&&(bnGridLoop==true)) strRowHTML += ' onclick="CheckUnfreezedColumn(this,'+i+',\'' + grDet.Name + '\');"';
else strRowHTML += ' onclick="SelectCheckBox_Clicked(this);" ';
strRowHTML += ' />';
strRowHTML += '<Input Type="Hidden" Name="' + grDet.Name + '_mode[]'+strName+'" ID="' + i + '" Value="B" /></TD>';
var strToolTip;
var vCmpValue;
var strfieldValue;
var strControlStyle='';
for (var j=0;j <intTotalColumns; j++) {
strfieldValue='';
strConForm='';
strToolTip='';
if (arrDataField[j]!='') {
if(grDet.DataFromAttrib=='0') strfieldValue=getFieldValue(RowList[i],arrDataField[j]);
else strfieldValue= getAttributeValue(RowList[i],arrDataField[j],'');
}
else strfieldValue='';
if ((strfieldValue=='') && (arrDataType[j] == "Number")) strfieldValue=arrDefaultValue[j];
strRowHTML += '<TD width="' + arrWidth[j] + strUnit + '" Align="' + arrAlignment[j] + '" class="' + strOddEvenStyle + '" _oldClass="' + strOddEvenStyle + '" ';
if (arrHidden[j]=='Y'||arrShowCol[j]=="1") strRowHTML += ' style="display:none;"';
if (grDet.Columns[j].ConditionalFormattingExists == true) strConForm = ApplyConditionalFormatting("C", strfieldValue,arrDataType[j],grDet.Columns[j].ConditionalFormattings,RowList[i],grDet.DataFromAttrib);
if((arrToolTip[j]!=null)&&(arrToolTip[j]!='')) {
if(grDet.DataFromAttrib=='0') strToolTip=getFieldValue(RowList[i],arrToolTip[j]);
else strToolTip=getAttributeValue(RowList[i],arrToolTip[j],'');
}
else if (grDet.SmartTip=='1')
strToolTip=strfieldValue;
strRowHTML += ' title="'+strToolTip+'" ';
strRowHTML += '>'+strConForm;
if (arrMandatory[j]=='Y') strControlStyle = arrControlStyleMand[j];
else strControlStyle = arrControlStyle[j]
if ((strfieldValue!='') && (arrDataType[j] == "Currency"))
strfieldValue = currency(strfieldValue,grDet.CurrencySep,grDet.digitsAfterDec);
if ((arrControlType[j]=="")||((colsFreezed>0)&&(bnGridLoop==true)) && !((arrControlType[j]=="Image") || (arrControlType[j]=="Hyperlink"))) {
if (arrMulti[j]=="1") strRowHTML += '<SPAN Name="' + arrName[j]+strName + '" id="' +strName+ i + '" style="OVERFLOW:hidden; height:'+(grDet.RowHeight-10)+strUnit+'" onclick="IncRowHeight(this,false,\''+grDet.RowHeight+'\',\''+strUnit+'\','+ i + ',' + grDet.RowMaxHeight + ',\'' + grDet.Name + '\','+grDet.FreezeColumns+');"> ';
strRowHTML += strfieldValue;
if (arrMulti[j]=="1") strRowHTML += '</SPAN>';
}
else if (arrControlType[j]=="Image") {
strRowHTML += '<IMG Name="' + arrName[j]+strName + '" id="' +strName+ i + '" ALT="' + strToolTip + '" Title="' + strToolTip + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
if (grDet.Columns[j].ConditionalFormattingExists == true)
strRowHTML += ApplyConditionalFormatting("I", strfieldValue,arrDataType[j],grDet.Columns[j].ConditionalFormattings,RowList[i],grDet.DataFromAttrib)
else strRowHTML += 'SRC="' + grDet.Columns[j].ImageURL + '" ';
strRowHTML += '/>'+'<p style="display:none">'+strfieldValue+'</p>';
}
else if (arrControlType[j]=="Hyperlink") {
strRowHTML += '<A ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="'+strName + i + '" ';
strRowHTML += 'href="'+HREF_VALUE+'" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j];
strRowHTML += '>'+strfieldValue+'</A>';
}
else if ((arrControlType[j]=="InputBox") || ((arrControlType[j]=="DropDown") && (arrKeyField[j]=='Y'))) {
if (arrMulti[j]=="1") {
strRowHTML += '<TEXTAREA style="overflow:hidden; height:'+(grDet.RowHeight-5)+strUnit+'" onClick="IncRowHeight(this,true,\''+grDet.RowHeight+'\',\''+strUnit+'\',' + i + ',' + grDet.RowMaxHeight + ',\'' + grDet.Name + '\','+grDet.FreezeColumns+');" '; }
else{
strRowHTML += '<INPUT Type="Text" ';
}
strRowHTML += 'Name="' + arrName[j]+strName+ '" ID="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
if ((arrDataType[j] == "String") && (arrKeyField[j]=='N')) strRowHTML += 'Value="' + replaceQuotes(strfieldValue) + '" ';
else strRowHTML += 'Value="' + strfieldValue + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
strRowHTML += ' Style="width:' + arrControlWidth[j] + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
if (arrMaxLength[j]!=null) {
if ((arrDataType[j]=='Number') || (arrDataType[j]=='Amount')) {
if (arrMaxLength[j].indexOf(',') > 0) strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
else strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',0,\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
}
else {
if (arrKeyField[j]=='Y')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'S\');" ';
else {
if (arrCase[j]=='U')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'\');" ';
else
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'\',\'\');" ';
}
}
}
strRowHTML += arrAdditionalAttr[j];
if (arrMulti[j]=="1")
strRowHTML += '>' + strfieldValue + '</TEXTAREA>';
else
strRowHTML += '/>';
}
else if ((arrControlType[j]=="CheckBox") || (arrControlType[j]=="Radio")){
var strType;
var strCtrl;
if (arrControlType[j]=="CheckBox") { strType="CheckBox"; strCtrl="chk"; }
else { strType="Radio"; strCtrl="rad"; }
strRowHTML += '<INPUT Type="' + strType + '" Name="' + strCtrl + '_' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" _Checked="' + strfieldValue + '" ';
if ((strfieldValue=='Y') || (strfieldValue=='true')) strRowHTML += 'CHECKED ';
strRowHTML += ' Style="width=' + CHECKBOX_WIDTH + strUnit + ';" ';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
strRowHTML += ' onclick="GridCheckBox_Clicked(this); ' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';
strRowHTML += '<Input Type="Hidden" Name="' + arrName[j] + '" id="' + i + '" Value="' + strfieldValue + '" />';
}
else if (arrControlType[j]=="Button") {
strRowHTML += '<INPUT Type="Button" Name="' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" Style="width:' + arrControlWidth[j] + strUnit + ';text-align:' + arrAlignment[j] + ';" ';
if ((arrOnClickEvent[j]!='') || (arrOnClickEvent[j]!=null)) strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + 'Value="' + strfieldValue + '" />';
}//inserted for file by virsing
else if (arrControlType[j]=="file") {
strRowHTML += '<INPUT Type="file" Name="' + arrName[j]+strName + '" id="' + strName+i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" Style="width:' + arrControlWidth[j] + strUnit + ';text-align:' + arrAlignment[j] + ';" ';
if ((arrOnClickEvent[j]!='') || (arrOnClickEvent[j]!=null)) strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + 'Value="' + strfieldValue + '" />';
}
//
else if (arrControlType[j]=="DropDown") {
strRowHTML += '<SELECT ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="' + strName+i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Readonly="true" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += ' Style="width:' + arrControlWidth[j] + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '>';
var strValue='Value="' + strfieldValue + '"';
var strComboValues=grDet.Columns[j].ComboValues;
strRowHTML += strComboValues.replace(strValue, strValue + ' SELECTED');
strRowHTML += '</SELECT>';
}
else if (arrControlType[j]=="InputSearch") {
strRowHTML += '<INPUT Type="Text" ';
strRowHTML += 'Name="' + arrName[j] +strName+ '" ';
strRowHTML += 'id="'+strName+ i + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += 'Value="' + strfieldValue + '" ';
if (arrMaxLength[j]!=null) {
if ((arrDataType[j]=='Number') || (arrDataType[j]=='Amount')) {
if (arrMaxLength[j].indexOf(',') > 0) strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
else strRowHTML += ' onkeypress="checkAmtWithNegative(this ,event, ' + arrMaxLength[j] + ',0,\'' + grDet.DecimalSep + '\',\'' + grDet.Columns[j].AllowNegative + '\');"';
}
else {
if (arrKeyField[j]=='Y')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'S\');" ';
else {
if (arrCase[j]=='U')
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'U\',\'\');" ';
else
strRowHTML += ' onkeypress="checkChar(this ,event, ' + arrMaxLength[j] + ',\'\',\'\');" ';
}
}
}
strRowHTML += ' Style="width:' + eval(arrControlWidth[j] + '-' + SEARCH_BUTTON_WIDTH) + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';
strRowHTML += '<INPUT Type="Button" ';
strRowHTML += 'Name="btn' + arrName[j] + '" ';
strRowHTML += 'Class="Grid_SearchButton" ';
strRowHTML += 'Style="Width:' + SEARCH_BUTTON_WIDTH + '; Height:' + SEARCH_BUTTON_HEIGHT + ';"';
strRowHTML += 'id="' + i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Disabled="true" ';
strRowHTML += 'Value="..." ';
strRowHTML += ' onclick="' + grDet.Columns[j].SearchButtonClick + '" />';
}
else if (arrControlType[j]=="DatePicker") {
strRowHTML += '<INPUT Type="Text" ';
strRowHTML += 'Name="' + arrName[j]+strName + '" ';
strRowHTML += 'id="'+strName+ i + '" ';
strRowHTML += 'Class="' + strControlStyle + '" ';
strRowHTML += '_oldClass="' + strControlStyle + '" ';
strRowHTML += 'Value="' + strfieldValue + '" ';
if ((arrKeyField[j]=='Y') || (arrReadonly[j]=='Y')) strRowHTML += ' Readonly="true" ';
if (arrMaxLength[j]!=null) strRowHTML += ' MaxLength="' + arrMaxLength[j] + '" ';
strRowHTML += ' Style="width:' + eval(arrControlWidth[j] + '-' + SEARCH_BUTTON_WIDTH) + strUnit + ';';
strRowHTML += ' text-align:' + arrAlignment[j] + ';" ';
strRowHTML += ' onchange="changeMode(' + grDet.Name + '_Table_Rows,' + i + ','+j+',\''+arrColSum[j]+'\',\''+grDet.Name+arrName[j]+'\',\''+arrDataType[j]+'\','+grDet.digitsAfterDec+',\''+grDet.DecimalSep+'\');' + arrOnChangeEvent[j] + '" ';
strRowHTML += ' onkeypress="checkDate(this, event,\'' + grDet.DateFormat + '\',\''+grDet.DateSeperator+'\');" ';
if (arrOnClickEvent[j]!='') strRowHTML += ' onclick="' + arrOnClickEvent[j] + '" ';
if (arrOnDblClickEvent[j]!='') strRowHTML += ' ondblclick="' + arrOnDblClickEvent[j] + '" ';
strRowHTML += arrAdditionalAttr[j] + '/>';;
strRowHTML += '<INPUT Type="Button" Name="btn' + arrName[j] + '" ';
strRowHTML += 'Style="Width:' + SEARCH_BUTTON_WIDTH + '; Height:' + SEARCH_BUTTON_HEIGHT + ';"';
strRowHTML += 'class="Grid_DatePickerButton" id="' + i + '" ';
if (arrKeyField[j]=='Y') strRowHTML += ' Disabled="true" ';
strRowHTML += 'Value="6" onclick="ShowCalender(this);" />';
}
else{
if ((strfieldValue==null) || (strfieldValue==''))
strfieldValue=' ';
if (arrDataType[j] == "Currency")
strRowHTML += currency(strfieldValue,grDet.CurrencySep,grDet.digitsAfterDec);
else
strRowHTML += strfieldValue;
}
if(strConForm!='') strRowHTML+='</p>';
strRowHTML += '</TD>';
}
strRowHTML += '</TR>';
sRet += strRowHTML;
}
sRet += '</TABLE>';
return(sRet);
}
function CreateGrid(GridID, DataID, ContainerID, GridTag, DataRootTag, DataRowTag){
var objGrid;
var grdH=0;
if (GridID.tagName==GridTag)
objGrid=GridID;
else
objGrid=GridID.getElementsByTagName(GridTag)[0];
if (objGrid == null) return;
var grDet=new DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag);
ContainerID.style.width=grDet.Width + grDet.UnitDesignator;
ContainerID.style.height=grDet.Height + grDet.UnitDesignator;
ContainerID.className=grDet.GridContainerStyle;
var strGridHTML="";
var strGridCaptionHTML="";
var strGridColHTML="";
var strGridRowHTML="";
var strGridFooterHTML="";
var colsFreezed=parseInt(grDet.FreezeColumns);
var strUnit = grDet.UnitDesignator;
if (grDet.Caption!="") strGridCaptionHTML +=getGridCaption(grDet);
var RowList=DataID.getElementsByTagName(DataRowTag);
nRowList=RowList.length;
if (grDet.ColumnHeaders!="") strGridColHTML = getGridColumnHeaders(GridID,grDet);
var strName='';
var iLoop=1;
var strReturn='';
var gridWidth=grDet.Width;
if((colsFreezed>0)&&(nRowList>0)) {
iLoop=2; strName="";
strReturn='<table border="0" cellspacing="0" cellpadding="0"><tr><td>';
strGridRowHTML += strReturn;
}
grdH=grDet.Height;
if((grDet.AllowAddNew=="1")||(grDet.AllowDelete=="1" && grDet.HideDeleteButton=="0")||(grDet.AllowRowMoving=="1")||(grDet.AllowPaging=="1")||(grDet.AllowShowMore!="0") || (grDet.AllowExcelExport=="1") || (grDet.AllowPrintPriview=="1")) grdH-=25;
for(var k=0;k<iLoop;k++) {
if((colsFreezed>0) && (k<=0)){
gridWidth=getGridWidth(grDet,colsFreezed-2);
bnGridLoop=true;
strName="1";
}
if((k>0)&&(colsFreezed>0)) {
strName="";
strGridRowHTML+="</td><td>";
gridWidth=(toNumber(grDet.Width)- getGridWidth(grDet,colsFreezed-2));
bnGridLoop=false;
}
strGridRowHTML += '<DIV id="' + grDet.Name + '_Div_Rows'+strName+'" class="Grid_DetailDIV'+strName+'" ';
if((colsFreezed>0) && (k<=0)){
strGridRowHTML += 'style="overflow-x:hidden; overflow-y:hidden;';
}
else {
//strGridRowHTML += 'style="overflow-x:' + grDet.ScrollbarX + '; overflow-y:' + grDet.ScrollbarY +';';
if(grDet.ShowSummary=="1")
strGridRowHTML += 'style="overflow-x:hidden; overflow-y:' + grDet.ScrollbarY +';';
else
strGridRowHTML += 'style="overflow-x:' + grDet.ScrollbarX + '; overflow-y:' + grDet.ScrollbarY +';';
}
strGridRowHTML += ' height:' + grdH + strUnit + '; width=' + gridWidth + strUnit + ';" ';
if (grDet.ColumnHeaders=='1') {
if(colsFreezed>0)
strGridRowHTML += ' onscroll="ScrollHeader(' + grDet.Name + '_Div_Rows,' + grDet.Name + '_Div_Columns,' + grDet.Name + '_Div_Rows1,'+grDet.Name + '_Div_Col_Totals,'+grDet.FreezeColumns+','+grDet.ShowSummary+');" ';
else
strGridRowHTML += ' onscroll="ScrollHeader(' + grDet.Name + '_Div_Rows,' + grDet.Name + '_Div_Columns,\'\','+grDet.Name + '_Div_Col_Totals,'+grDet.FreezeColumns+','+grDet.ShowSummary+');" ';
}
strGridRowHTML += '>';
strGridRowHTML += getGridRows(grDet,RowList);
strGridRowHTML += '</DIV>';
if(colsFreezed<=0) break;
}
if((colsFreezed>0)&&(nRowList>0)) strGridRowHTML+='</td></tr></table>';
strGridRowHTML+=getGridTotalColumns(grDet);
//strGridRowHTML += '</TD></TR>'; //Nilesh - commented existing
if ((grDet.AllowAddNew=="1") || (grDet.AllowDelete=="1" && grDet.HideDeleteButton=="0") || (grDet.AllowRowMoving=="1") || (grDet.AllowPaging=="1") ||(grDet.AllowZoom=="1")|| (grDet.AllowShowMore!="0")||(grDet.AllowExcelExport=="1")||(grDet.AllowPrintPreview=="1")||(grDet.AllowPrint=="1") ) {
var intTotalRows=RowList.length;
strGridFooterHTML=getGridFooter(GridID, grDet, ContainerID.id,intTotalRows, GridTag, DataRootTag, DataRowTag);
}
strGridHTML += strGridCaptionHTML;
if (grDet.ColumnHeaders=="1") strGridHTML += strGridColHTML;
strGridHTML += strGridRowHTML;
strGridHTML += strGridFooterHTML;
ContainerID.innerHTML=strGridHTML;
if(nRowList>0)
setAllColTotals(grDet);
}
function DrawGrid(GridID, DataID, ContainerID) {
CreateGrid(GridID, DataID, ContainerID,"Grid","DataRows","row");
}
function DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag) {
this.AllowAddNew = getAttributeValue(objGrid,"AllowAddNew","0");
this.AllowDelete = getAttributeValue(objGrid,"AllowDelete","0");
this.AllowSort = getAttributeValue(objGrid,"AllowSort","1");
this.UnitDesignator = getAttributeValue(objGrid,"UnitDesignator","px");
this.ScrollbarX = getAttributeValue(objGrid,"Scrollbar-x","scroll");
this.ScrollbarY = getAttributeValue(objGrid,"Scrollbar-y","scroll");
this.AllowRowMoving = getAttributeValue(objGrid,"AllowRowMoving","0");
this.AllowZoom = getAttributeValue(objGrid,"AllowZoom","0");
this.ZoomValue=100;
this.Caption = getAttributeValue(objGrid,"Caption","");
this.CaptionStyle = getAttributeValue(objGrid,"CaptionStyle","Grid_CaptionClass");
this.CaptionAlignment = getAttributeValue(objGrid,"CaptionAlignment","Left");
this.ColumnHeaders = getAttributeValue(objGrid,"ColumnHeaders","1");
this.RowNumbers = getAttributeValue(objGrid,"RowNumbers","1");
this.RowNumberColWidth = getAttributeValue(objGrid,"RowNumberColWidth","22");
this.RowSelectorColWidth = getAttributeValue(objGrid,"RowSelectorColWidth","22");
this.Name = getAttributeValue(objGrid,"Name",objGrid.id + "_Grid");
this.Height = getAttributeValue(objGrid,"Height",GRID_HEIGHT);
var intWidth = getAttributeValue(objGrid,"Width",GRID_WIDTH);
if(BASE_RESOLUTION<=800){
intWidth=toNumber(intWidth);
if (screen.width>800) this.Width=Math.round(intWidth * 1.3) + "";
else this.Width=intWidth + "";
}
else
this.Width=intWidth+"";
this.RowHeight = getAttributeValue(objGrid,"RowHeight",ROW_HEIGHT);
this.ColHeaderHeight = getAttributeValue(objGrid,"ColHeaderHeight",COL_HEADER_HEIGHT);
this.OddRowStyle = getAttributeValue(objGrid,"OddRowStyle","Grid_OddRowStyle");
this.EvenRowStyle = getAttributeValue(objGrid,"EvenRowStyle","Grid_EvenRowStyle");
this.ActiveRowStyle = getAttributeValue(objGrid,"ActiveRowStyle","Grid_ActiveRowStyle");
this.AllowPaging = getAttributeValue(objGrid,"AllowPaging","0");
this.AllowColResize = getAttributeValue(objGrid,"AllowColResize","0");
this.NewRowStyle = getAttributeValue(objGrid,"NewRowStyle","Grid_NewRowStyle");
this.DeleteRowStyle = getAttributeValue(objGrid,"DeleteRowStyle","Grid_DeleteRowStyle");
this.DateFormat = getAttributeValue(objGrid,"DateFormat",DATE_FORMAT);
DATE_FORMAT=this.DateFormat;
this.PrevPageClick = getAttributeValue(objGrid,"PrevPageClick","");
this.NextPageClick = getAttributeValue(objGrid,"NextPageClick","");
this.BeforeAddNew = getAttributeValue(objGrid,"BeforeAddNew","");
this.AfterDelete= getAttributeValue(objGrid,"AfterDelete","");
this.DecimalSep = getAttributeValue(objGrid,"DecimalSeperator",DECIMAL_SEPERATOR);
this.GridContainerStyle = getAttributeValue(objGrid,"GridContainerStyle","Grid_ContainerClass");
this.ApplyActiveRowStyle = getAttributeValue(objGrid,"ApplyActiveRowStyle","1");
this.CurrencySep = getAttributeValue(objGrid,"CurrencySeperator",CURRENCY_SEPERATOR);
this.digitsAfterDec = getAttributeValue(objGrid,"DigitsAfterDecimal",DIGITS_AFTER_DECIMAL);
this.ImageURL = getAttributeValue(objGrid,"ImageURL","");
this.HideDeleteButton = getAttributeValue(objGrid,"HideDeleteButton","0");
this.FreezeColumns = getAttributeValue(objGrid,"FreezeColumns","0");
this.AllowShowMore = getAttributeValue(objGrid,"AllowShowMore","0");
this.SubHeaders = getAttributeValue(objGrid,"SubHeaders","0");
this.CollapseColumns = getAttributeValue(objGrid,"CollapseColumns","0");
this.SmartTip = getAttributeValue(objGrid,"SmartTip","0");
this.RowMaxHeight=getAttributeValue(objGrid,"RowMaxHeight",ROW_HEIGHT);
this.AllowCollapseAdd=getAttributeValue(objGrid,"AllowCollapseAdd","0");
this.ShowSummary=getAttributeValue(objGrid,"ShowSummary","0");
this.SummaryRows=getAttributeValue(objGrid,"SummaryRows","1");
this.AfterAddNew=getAttributeValue(objGrid,"AfterAddNew","");
this.DateSeperator=getAttributeValue(objGrid,"DateSeperator",DATE_SEPERATOR);
this.DataFromAttrib=getAttributeValue(objGrid,"DataFromAttribute","0");
this.DocObject=eval(getAttributeValue(objGrid,"DocumentObj",document));
this.OvRidAdRw=getAttributeValue(objGrid,"OverRideAddRow","");
function ReportParam(objNode) {
this.Caption=getAttributeValue(objNode,"Caption","");
this.Value= getAttributeValue(objNode,"Value","");
}
function ConditionalFormatting(Operator,Value1,Value2,SuccessStyle,vCompareField,vCompareType){
this.strOperator=Operator;
this.strValue1=Value1;
this.strValue2=Value2;
this.strSuccessStyle=SuccessStyle;
this.strCompareField=vCompareField;
this.strCompareType=vCompareType;
}
function GridColumn(objColumnNode) {
this.Name=getAttributeValue(objColumnNode,"Name","");
this.Width=getAttributeValue(objColumnNode,"Width",COL_WIDTH);
this.Caption=getAttributeValue(objColumnNode,"Caption","");
this.CaptionAlignment= getAttributeValue(objColumnNode,"CaptionAlignment","center");
this.DataField= getAttributeValue(objColumnNode,"DataField","");
this.DataType= getAttributeValue(objColumnNode,"DataType","String");
this.HeaderCaption=getAttributeValue(objColumnNode,"HeaderCaption","");
this.MultiLine = getAttributeValue(objColumnNode,"MultiLine","0");
this.ToolTipField = getAttributeValue(objColumnNode,"ToolTipField","");
this.Alignment= getAttributeValue(objColumnNode,"Alignment","");
if ((this.Alignment==null) || (this.Alignment=='')){
switch(this.DataType) {
case "String":
this.Alignment="Left"; break;
case "Number":
this.Alignment="Right"; break;
case "Currency":
this.Alignment="Right"; break;
case "Date":
this.Alignment="Left"; break;
}
}
this.DefaultValue=getAttributeValue(objColumnNode,"DefaultValue","");
this.ControlType=getAttributeValue(objColumnNode,"ControlType","");
this.Case=getAttributeValue(objColumnNode,"Case","");
if ((this.ControlType=="CheckBox") && (this.DefaultValue=="")) this.DefaultValue="N";
this.ControlStyle=getAttributeValue(objColumnNode,"ControlStyle","");
this.ControlStyleMand=getAttributeValue(objColumnNode,"MandControlStyle","");
if ((this.ControlStyle==null) || (this.ControlStyle=="")) {
if ((this.ControlType=="InputBox")||(this.ControlType=="InputSearch")||(this.ControlType=="DatePicker")) {
this.ControlStyle='Grid_InputBoxStyle';
this.ControlStyleMand='Grid_InputBoxMandStyle';
}else if (this.ControlType=="DropDown") {
this.ControlStyle='Grid_DropDownStyle';
this.ControlStyleMand='Grid_DropDownMandStyle';
}else if (this.ControlType=="Button")
this.ControlStyle='Grid_ButtonStyle';
else if (this.ControlType=="CheckBox") {
this.ControlStyle='Grid_CheckBoxStyle';
this.ControlStyleMand='Grid_CheckBoxMandStyle';
}
else if (this.ControlType=="Hyperlink")
this.ControlStyle='Grid_HyperLink';
}
this.ControlWidth = getAttributeValue(objColumnNode,"ControlWidth","");
this.AdditionalAttributes = getAttributeValue(objColumnNode,"AdditionalAttributes","");
this.MaxLength = getAttributeValue(objColumnNode,"MaxLength",null);
this.SearchButtonClick = getAttributeValue(objColumnNode,"SearchButtonClick","");
this.KeyField = getAttributeValue(objColumnNode,"Key","N");
this.Hidden = getAttributeValue(objColumnNode,"Hidden","N");
this.XMLDataIslandID = getAttributeValue(objColumnNode,"XMLDataIslandID","");
this.Mandatory = getAttributeValue(objColumnNode,"Mandatory","N");
this.Readonly = getAttributeValue(objColumnNode,"Readonly","N");
this.AllowNegative = getAttributeValue(objColumnNode,"AllowNegative","0");
this.OnChangeEvent = getAttributeValue(objColumnNode,"OnChangeEvent","");
this.OnClickEvent = getAttributeValue(objColumnNode,"OnClickEvent","");
this.OnDblClickEvent = getAttributeValue(objColumnNode,"OnDblClickEvent","");
this.HeaderCheckBox = getAttributeValue(objColumnNode,"HeaderCheckBox","0");
this.OnHCheckboxClick=getAttributeValue(objColumnNode,"OnHCheckboxClick","");
this.ImageURL = getAttributeValue(objColumnNode,"ImageURL","");
var arrColConditionalFormats;
var lstCondFormattings =objColumnNode.getElementsByTagName("ConditionalFormattings");
var blnColConditionalFormatExists=false;
try{
blnColConditionalFormatExists=(lstCondFormattings.length>0);
}
catch(e){
blnColConditionalFormatExists=false;
}
if (blnColConditionalFormatExists==true){
if (lstCondFormattings[0]!=null) {
var lstCondFormatting=lstCondFormattings[0].getElementsByTagName("ConditionalFormatting");
arrColConditionalFormats=new Array(lstCondFormatting.length);
for(var x=0;x<lstCondFormatting.length;x++) {
var strCFOperator=getAttributeValue(lstCondFormatting[x],"Operator","");
var strCFValue1=getAttributeValue(lstCondFormatting[x],"Value1","");
var strCFValue2=getAttributeValue(lstCondFormatting[x],"Value2","");
var strCFSuccessStyle=getAttributeValue(lstCondFormatting[x],"SuccessStyle","");
var strCompareField=getAttributeValue(lstCondFormatting[x],"CompareField","");
var strCompareType=getAttributeValue(lstCondFormatting[x],"CompareType","");
arrColConditionalFormats[x]=new ConditionalFormatting(strCFOperator, strCFValue1 , strCFValue2 , strCFSuccessStyle,strCompareField,strCompareType);
}
}
}
this.ConditionalFormattingExists=blnColConditionalFormatExists;
this.ConditionalFormattings=arrColConditionalFormats;
if (this.ControlType=="DropDown") this.ComboValues = GetComboValues(objColumnNode, this.XMLDataIslandID, GridTag, DataRootTag, DataRowTag) + '';
else this.ComboValues='';
//Nilesh - Summary
var isSum=getAttributeValue(objColumnNode,"Sum","0");
isSum+=','+getAttributeValue(objColumnNode,"Avg","0");
isSum+=','+getAttributeValue(objColumnNode,"Count","0");
isSum+=','+getAttributeValue(objColumnNode,"Min","0");
isSum+=','+getAttributeValue(objColumnNode,"Max","0");
this.ColumnSummary=isSum;
}
var CollList=objGrid.getElementsByTagName("Column");
if (CollList == null) return;
var intTotalColumns = CollList.length;
var arrColumns = new Array(intTotalColumns);
for (var i=0;i <intTotalColumns; i++)
arrColumns[i] = new GridColumn(CollList[i]);
this.Columns = arrColumns;
this.AllowExcelExport = getAttributeValue(objGrid,"AllowExcelExport","0");
this.AllowPrintPreview = getAttributeValue(objGrid,"AllowPrintPreview","0");
this.AllowPrint = getAttributeValue(objGrid,"AllowPrint","0");
//if ((this.AllowExcelExport=='1') || (this.AllowPrintPreview=='1') || (this.AllowPrint=='1')) {
this.ReportTitle = getAttributeValue(objGrid,"ReportTitle","");
this.HeaderLeft = getAttributeValue(objGrid,"HeaderLeft","");
this.HeaderCenter = getAttributeValue(objGrid,"HeaderCenter","");
this.HeaderRight = getAttributeValue(objGrid,"HeaderRight","");
this.FooterLeft = getAttributeValue(objGrid,"FooterLeft","");
this.FooterCenter = getAttributeValue(objGrid,"FooterCenter","");
this.FooterRight = getAttributeValue(objGrid,"FooterRight","");
this.PaperOrientation = getAttributeValue(objGrid,"PaperOrientation","P");
var objRptPrmSect = objGrid.getElementsByTagName("ReportParamSection");
if (null!=objRptPrmSect) {
if (objRptPrmSect.length>0) {
objRptPrmSect = objRptPrmSect[0];
var intTotColumns = getAttributeValue(objRptPrmSect,"NoOfColumns","1");
this.DisplayColumns = intTotColumns;
var arrRptParams = objRptPrmSect.getElementsByTagName("Param");
var intTotParams = arrRptParams.length;
var arrParams = new Array(intTotParams);
for (var i=0;i<intTotParams;i++)
arrParams[i] = new ReportParam(arrRptParams[i]);
this.TotalReportParams = intTotParams;
this.ReportParams = arrParams;
}
}
else
this.TotalReportParams=0;
//}
}
function getAttributeValue(p_nodeobj, p_AName, p_Default){
var tempvalue=p_nodeobj.getAttribute(p_AName);
if (tempvalue==null) tempvalue=p_Default;
return(tempvalue);
}
function getFieldValue(dataRow,strFieldName) {
var element=dataRow.selectSingleNode(strFieldName);
if (element==null) return('');
else return(element.text);
}
function getComboElements(objElement, columnTAG, objColumn, ComboDataIsland, GridTag, DataRootTag, DataRowTag) {
var objRows;
if (ComboDataIsland=='') {
var cmbItems=columnTAG.getElementsByTagName("Item");
var strOptions='';
for (var Index=0;Index<cmbItems.length;Index++) {
var strSelected;
var strValue=cmbItems[Index].getAttribute('Value');
if (objColumn.DefaultValue==strValue) strSelected='SELECTED';
else strSelected='';
strOptions = '<OPTION Value="' + strValue + '" ' + strSelected + ' ></OPTION>';
var tmpOptions=document.createElement(strOptions);
tmpOptions.appendChild(document.createTextNode(cmbItems[Index].text));
objElement.appendChild(tmpOptions);
}
return(objElement);
}
else {
var objComboData=document.getElementById(ComboDataIsland);
if ((objComboData==null) || (objComboData.documentElement == undefined)){
objComboData = document.XMLDocument.documentElement.selectSingleNode(ComboDataIsland);
if (objComboData==null) return '';
objRows=objComboData.getElementsByTagName(DataRowTag);
}
else {
var objGrid=objComboData.getElementsByTagName(GridTag)[0];
var objDataRows=objGrid.getElementsByTagName(DataRootTag)[0];
objRows=objDataRows.getElementsByTagName(DataRowTag);
}
var strOptions=''
for (var i=0;i<objRows.length;i++) {
var strSelected;
var strValue=objRows[i].childNodes.item(0).text;
if (objColumn.DefaultValue==strValue) strSelected='SELECTED';
else strSelected='';
strOptions = '<OPTION Value="' + strValue + '" ' + strSelected + ' ></OPTION>';
var tmpOptions=document.createElement(strOptions);
tmpOptions.appendChild(document.createTextNode(objRows[i].childNodes.item(1).text));
objElement.appendChild(tmpOptions);
}
return(objElement);
}
}
function CreatePage(GridID, DataID, ContainerID, GridTag, DataRootTag, DataRowTag){
var objGrid=GridID.getElementsByTagName(GridTag)[0];
if (objGrid == null) return;
var grDet=new DHTMLGrid(objGrid, GridTag, DataRootTag, DataRowTag);
var strGridRowHTML="";
var RowList=DataID.getElementsByTagName(DataRowTag);
var GridRowContainer;
var arrDivTags=ContainerID.getElementsByTagName('DIV');
var iLoop=1;
var strName='';
var colsFreezed=parseInt(grDet.FreezeColumns);
if(colsFreezed>0)iLoop=2;
for(var k=0;k<iLoop;k++) {
bnGridLoop=false;
strName="";
if((k<=0) && (iLoop==2)) { bnGridLoop=true; strName="1"; }
strGridRowHTML = getGridRows(grDet,RowList);
for (var i=0;i <arrDivTags.length;i++) {
if (arrDivTags[i].id==grDet.Name+'_Div_Rows'+strName) {
GridRowContainer=arrDivTags[i];
break; }
}
if (GridRowContainer!=null) GridRowContainer.innerHTML=strGridRowHTML;
}
}
function DisplayPage(GridID, DataID, ContainerID) {
CreatePage(GridID, DataID, ContainerID, "Grid", "DataRows", "row")
}
function ApplyConditionalFormatting(strType, strCellValue, varStrDataType, arrFormattings,rowList) {
var strResult='';
if (strType!='I') strResult='<P';
var vntActualValue;
var strDataType='';
var vCmpFld='';
var vCmpValue='';
var Value1;
var Value2;
var cmpField;
strDataType=varStrDataType;
for(var intIndex=0;intIndex<arrFormattings.length;intIndex++) {
vCmpFld=arrFormattings[intIndex].strCompareField; //Nilesh
if (strType=='C') strDataType=arrFormattings[intIndex].strCompareType; //Nilesh
if ((vCmpFld!=null)&&(vCmpFld!='')) {
vCmpValue=getFieldValue(rowList,vCmpFld);
strDataType=arrFormattings[intIndex].strCompareType;
}
else {
vCmpValue=strCellValue;
}
if ((strDataType=='Number') || (strDataType=='Currency')) {
vntActualValue=vCmpValue;//strCellValue;
Value1=toNumber(arrFormattings[intIndex].strValue1);
if (arrFormattings[intIndex].strValue2!=null) Value2=toNumber(arrFormattings[intIndex].strValue2);
}
else if (strDataType=='String') {
vntActualValue='\'' + vCmpValue + '\'';//'\'' + strCellValue + '\'';
Value1='\'' + arrFormattings[intIndex].strValue1 + '\'';
if (arrFormattings[intIndex].strValue2!=null) Value2='\'' + arrFormattings[intIndex].strValue2 + '\'';
}
else if (strDataType=='Date') {
vntActualValue='getDateFromFormat(\'' + vCmpValue + '\')'; //'getDateFromFormat(\'' + strCellValue + '\')';
Value1='getDateFromFormat(\'' + arrFormattings[intIndex].strValue1 + '\')';
if (arrFormattings[intIndex].strValue2!=null) Value2='getDateFromFormat(\'' + arrFormattings[intIndex].strValue2 + '\')';
}
var blnRetValue=false;
var strexp='';
switch(arrFormattings[intIndex].strOperator) {
case 'LT':
strexp=vntActualValue + ' < ' + Value1; break;
case 'GT':
strexp=vntActualValue + ' > ' + Value1; break;
case 'EQ':
strexp=vntActualValue + ' == ' + Value1; break;
case 'LTEQ':
strexp=vntActualValue + ' <= ' + Value1; break;
case 'GTEQ':
strexp=vntActualValue + ' >= ' + Value1; break;
case 'NOTEQ':
strexp=vntActualValue + ' != ' + Value1; break;
case 'BET':
strexp='((' + vntActualValue + ' >= ' + Value1 + ') && ( ' + vntActualValue + ' <= ' + Value2 + '))'; break;
case 'NOTBET':
strexp='(!((' + vntActualValue + ' >= ' + Value1 + ') && ( ' + vntActualValue + ' <= ' + Value2 + ')))'; break;
}
if (strexp != null) {
blnRetValue=eval(strexp);
if (blnRetValue==true) {
if (strType=='I') strResult= ' SRC="' + arrFormattings[intIndex].strSuccessStyle + '"';
else strResult+= ' class="' + arrFormattings[intIndex].strSuccessStyle + '"';
break; }
}
}
if ((strType!='I')&&(strType!='C')) strResult+='>' + strCellValue + '</P>';
if(strType=='C') strResult+='>';
return(strResult);
}
function resetActiveRow(tlbDetail, actRow) {
if (actRow >= 0) {
var bod = tlbDetail.tBodies[0];
if (bod.rows[actRow]._Mode=="N")
applyRowStyle(tlbDetail, bod.rows[actRow], tlbDetail._NewRowStyle);
else if ((bod.rows[actRow]._Mode=="D") || (bod.rows[actRow]._Mode=="X"))
applyRowStyle(tlbDetail, bod.rows[actRow], tlbDetail._DeleteRowStyle);
else {
if (actRow%2==0) applyRowStyle(tlbDetail, bod.rows[actRow],tlbDetail._EvenRowStyle);
else applyRowStyle(tlbDetail, bod.rows[actRow],tlbDetail._OddRowStyle);
}
}
}
function setActiveRow(tlbDetail, prow, colsFreezed) {
var oldRow=parseInt(tlbDetail._ActiveRow);
var actRow=parseInt(prow.cells[0].innerText)-1;
tlbDetail._ActiveRow=actRow;
resetActiveRow(tlbDetail, oldRow);
applyRowStyle(tlbDetail, prow, tlbDetail._ActiveRowStyle);
if(colsFreezed>0){
var gName=Mid(tlbDetail.id,0,tlbDetail.id.indexOf("_Table_Rows"));
if(tlbDetail.id==gName+"_Table_Rows")
var tlbDetail2 = document.getElementById(gName+"_Table_Rows1");
else
var tlbDetail2 = document.getElementById(gName+"_Table_Rows");
resetActiveRow(tlbDetail2, oldRow);
applyRowStyle(tlbDetail2, tlbDetail2.rows[actRow], tlbDetail2._ActiveRowStyle);
}
}
function applyRowStyle(tlbDetail, pRow, newStyle) {
var startIndex=2;
if (pRow._Mode=="N")
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",tlbDetail._NewRowStyle,0);
else if ((pRow._Mode=="D") || (pRow._Mode=="X"))
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",tlbDetail._DeleteRowStyle,0);
else
for (var i=startIndex; i<pRow.cells.length;i++) pRow.cells[i].setAttribute("classname",newStyle,0);
}
function getGridColumnHeaders(GridID,grDet){
var sRet='';
var strTHead='';
var strGrp='';
var strNum='';
var strInnerText='';
var colsTag='';
var strScrollBarY='';
var gridWidth=grDet.Width;
var strUnit = grDet.UnitDesignator;
var returnStr='';
var i;
var colsToMerge=new Array();
var colsFreezed=0;
var lngRowTableWidth=getRowTableWidth(grDet);
if((grDet.FreezeColumns!="0")||(grDet.CollapseColumns=="1")) lngRowTableWidth="0";
if (grDet.ScrollbarY=='hidden') strScrollBarY='hidden';
else strScrollBarY=grDet.ScrollbarY;
if((grDet.FreezeColumns!="0") && (nRowList >0)) colsFreezed=parseInt(grDet.FreezeColumns);
if(colsFreezed>0) returnStr='<table cellspacing="0" colspacing="0" border="0"><tr><td>';
for(var k=0;k<2;k++)
{
if(colsFreezed<=0) strNum='';
if((k>0) && (colsFreezed>0)){
gridWidth=(parseInt(grDet.Width)- parseInt(getGridWidth(grDet,colsFreezed-2))-4)+"";
if(colsFreezed>0) returnStr+='</td><td>';
strScrollBarY=grDet.ScrollbarY;
strNum="";
}
else{
if(colsFreezed>0) { gridWidth=getGridWidth(grDet,colsFreezed-2) ; strNum="1"; strScrollBarY='hidden'; };
}
sRet = '<DIV ID="' + grDet.Name + '_Div_Columns'+strNum+'" class="Grid_HeaderDIV" ';
sRet += 'style="overflow-x:hidden; overflow-y:' + strScrollBarY + '; height=' + grDet.ColHeaderHeight + strUnit + '; width=' + gridWidth + strUnit + ';"> ';
sRet += '<TABLE ID="' + grDet.Name + '_Table_Headers'+strNum+'" border="0" width="' + lngRowTableWidth + strUnit + '" height="100%" cellpadding="0" cellspacing="0" style="table-layout:fixed;" >';
strTHead = '<THEAD>';
colsToMerge = new Array(grDet.Columns.length);
if(grDet.SubHeaders=="1") strGrp=getGridSubHeaders(GridID, grDet,k,colsToMerge);
strTHead += strGrp + '<TR>';
if(k>0){
colsTag='<COL width="1' + strUnit + '" style="display:none;">';
colsTag+='<COL width="1'+ strUnit + '" style="display:none;">';
}
else {
colsTag='<COL width="' + grDet.RowNumberColWidth + strUnit+'"';
if (grDet.RowNumbers == "0") colsTag+=' style="display:none;"';
colsTag+='>';
colsTag+='<COL width="' + grDet.RowSelectorColWidth + strUnit+'"';
if (!((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1"))) colsTag+=' style="display:none;"';
colsTag+='>';
}
if(grDet.SubHeaders!="1") { /*Nilesh - Check for subheaders for rowspan */
strTHead += '<TH width="' + grDet.RowNumberColWidth + strUnit + '" class="Grid_HeaderClass" ';
strTHead += ' id="' + grDet.Name + '"_Row_Number"> </TH>';
strTHead += '<TH width="' + grDet.RowSelectorColWidth + strUnit + '" align="center" class="Grid_CheckBoxHeaderColumn" ';
strTHead += ' id="' + grDet.Name + '"_Row_Selector"><INPUT Type="CheckBox" Name="' + grDet.Name + 'chkSelectAll'+strNum+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="doSelectAll(' + grDet.Name + 'chkSelectAll'+strNum+',' + grDet.Name + '_Table_Rows'+strNum+', \'' + grDet.DeleteRowStyle + '\',' + grDet.FreezeColumns + ');" ';
strTHead += ' /></TH>';
}
var strColWidth='';
var strStyle='';
var colsVisible=getVisibleCols(grDet);
for (i=0;i<grDet.Columns.length; i++){
strColWidth="0";
strStyle='';
if(k>0){
if(i<(colsFreezed-2)){ strColWidth ="1"; strStyle=' style="display:none;"';} }
else {
if(colsFreezed>0) { if(i>=(colsFreezed-2)) { strColWidth ="1"; strStyle=' style="display:none;"'; } } }
if((grDet.AllowShowMore!="0")&&(grDet.Columns[i].Hidden!='Y')) {
//if(i>=((parseInt(grDet.Columns.length)-parseInt(grDet.AllowShowMore))))
if (i>=(colsVisible-parseInt(grDet.AllowShowMore)))
strColWidth="1";
}
colsTag+='<COL id="'+strNum+'c'+grDet.Name+i+'" width="' + grDet.Columns[i].Width + strUnit+'" ';
if(grDet.Columns[i].Hidden=="Y"||strColWidth=="1") colsTag+=' style="display:none;"';
colsTag+=strStyle+'>';
if(colsToMerge[i]!="R") {
strTHead += '<TH id="head_' + grDet.Columns[i].Name + '" ColumnName="' + grDet.Columns[i].Name + '" width="' + grDet.Columns[i].Width + strUnit + '" ';
strTHead += ' DataType="' + grDet.Columns[i].DataType + '" ';
strTHead += ' _Position="' + ( i + 2) + '" _displayMode="E" ';
strTHead += ' Align="' + grDet.Columns[i].CaptionAlignment + '" ';
if (grDet.Columns[i].Mandatory=='Y') strTHead += 'class="Grid_HeaderMandClass" ';
else strTHead += 'class="Grid_HeaderClass" ';
strTHead += '>';
strInnerText='';
if ((grDet.CollapseColumns=="1") && (grDet.SubHeaders!="1")) {
if ((colsFreezed>0) && (k<1)) {
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="1" align="left"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-2) + strUnit + '"'
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
else
{
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="15" align="left"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value="" name="BtnExpand'+grDet.Name+i+'" title="Expand/Colapse columns" _Collapsed="E" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'E\');"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-30)+strUnit+'"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
}
else
{
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grDet.Columns[i].Width+'"><tr>';
strInnerText += '<td width="1" align="left"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grDet.Columns[i].Width-2) + strUnit + '"'
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+i+',' + grDet.FreezeColumns + ');"';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
strTHead +=strInnerText;
}
if (grDet.Columns[i].HeaderCheckBox=='1') {
strTHead += '<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll,' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strTHead += grDet.Columns[i].OnHCheckboxClick;
strTHead += '" /> ';
}
strTHead += grDet.Columns[i].Caption;
if ((grDet.CollapseColumns=="1") && (grDet.SubHeaders!="1")) {
if((colsFreezed>0) && (k<1)) {
strInnerText = '</td><td width="1">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
else {
strInnerText = '</td><td width="15"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value=3 name="BtnCollapse'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'C\');">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
}
else {
strInnerText = '</td><td width="1">';
strTHead += strInnerText;
strTHead += '</td></tr></table>';
}
strTHead += '</TH>';
}
}
strTHead += '</TR></THEAD>';
sRet += colsTag+strTHead+'</TABLE></DIV>';
returnStr +=sRet;
if(colsFreezed<=0) break;
}
if(colsFreezed>0) returnStr+='</td><tr></table>';
sRet=returnStr;
return(sRet);
}
function getGridWidth(grDet, colsNum) {
var lngRowTableWidth=0;
if (grDet.RowNumbers == "1") lngRowTableWidth+=toNumber(grDet.RowNumberColWidth);
if ((grDet.AllowDelete=="1") || (grDet.AllowRowMoving=="1")) lngRowTableWidth+=toNumber(grDet.RowSelectorColWidth);
for (var i=0; i<colsNum;i++) {
if (grDet.Columns[i].Hidden!='Y') {
if (i==grDet.Columns.length-1) {
var intGridWidth=0;
lngRowTableWidth+=intGridWidth-lngRowTableWidth;
}
else
lngRowTableWidth+=toNumber(grDet.Columns[i].Width);
}
}
return(lngRowTableWidth);
}
function getGridSubHeaders(GridID, grDet,k, colsToMerge)
{
var sRet='';
var strTHead='';
var strInnerText='';
var strCol='';
var strNum='';
var grpWidth=0;
var iSortCol=0;
var colSpanned='';
var strUnit = grDet.UnitDesignator;
var lngRowTableWidth=0;
var colsFreezed=parseInt(grDet.FreezeColumns);
if((colsFreezed>0)&&(k<1))
strNum="1";
else
strNum="";
strTHead = '<TR><TH width="' + grDet.RowNumberColWidth + strUnit + '" class="Grid_HeaderClass" ';
strTHead += ' ID="' + grDet.Name + '"_Row_Number" rowspan="2"> </TH>';
strTHead += '<TH width="' + grDet.RowSelectorColWidth + strUnit + '" align="center" class="Grid_CheckBoxHeaderColumn" ';
strTHead += ' ID="' + grDet.Name + '"_Row_Selector" rowspan="2"><INPUT Type="CheckBox" Name="' + grDet.Name + 'chkSelectAll'+strNum+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strTHead += ' onclick="doSelectAll(' + grDet.Name + 'chkSelectAll'+strNum+',' + grDet.Name + '_Table_Rows'+strNum+', \'' + grDet.DeleteRowStyle + '\',' + grDet.FreezeColumns + ');" ';
strTHead += ' /></TH>';
colSpanned=1;
var currCaption='';
var curWidth=0;
var sortCol=0;
for(var i=0;i<grDet.Columns.length-1;i++) {
currCaption=grDet.Columns[i].HeaderCaption;
if(currCaption=='') currCaption=i+"";
curWidth = parseInt(grDet.Columns[i].Width);
if((currCaption==grDet.Columns[i+1].HeaderCaption) && (grDet.Columns[i].Hidden !='Y')){
colSpanned=colSpanned+1;
grpWidth += parseInt(curWidth);
}
if((currCaption!=grDet.Columns[i+1].HeaderCaption)){
if(colSpanned>1)
grpWidth += parseInt(curWidth);
else
grpWidth =parseInt(curWidth);
strCol = '<TH ColumnName="' + grDet.Columns[i].Name+'" width="'+ grpWidth + strUnit + '" ';
strCol += ' _Position="' + ( i + 2) + '" _displayMode="E" ';
strCol += ' Align="' + grDet.Columns[i].CaptionAlignment + '" ';
if (grDet.Columns[i].Mandatory=='Y') strCol += 'class="Grid_HeaderMandClass" ';
else strCol += ' class="Grid_HeaderCellClass" ';
strTHead += strCol;
if(colSpanned<=1) currCaption = grDet.Columns[i].Caption;
strInnerText='';
strInnerText = '<table border="0" cellspacing="0" cellpadding="0" width="'+grpWidth+'" _mode[]="E"><tr>';
if (grDet.CollapseColumns=="1") {
if ((colsFreezed>0) && (k<1)) {
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth) + strUnit + '"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,'+grDet.Name+'_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText +='>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll'+k+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll'+k+',' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
}
else {
strInnerText += '<td width="15" align="left"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value="" name="BtnExpand'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'E\');"></td>';
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth-30) + strUnit + '" ';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText += ' style="CURSOR: hand;" onclick="SortColumn(this,' + grDet.Name + '_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText += '>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll,' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
strInnerText += '</td><td width="15"><INPUT class="Grid_CollapseButton" id="'+i+'" type=button value=3 name="BtnCollapse'+grDet.Name+i+'" title="Expand/Colapse columns" onclick="CollapseColumn(\''+ GridID.id + '\',this,' + grDet.Name + '_Table_Rows,\'C\');">'; }
}
else
{
strInnerText += '<td align="'+ grDet.Columns[i].CaptionAlignment +'" width="' + (grpWidth) + strUnit + '"';
if ((grDet.AllowSort=='1') && (grDet.Columns[i].HeaderCheckBox!='1')) strInnerText+=' style="CURSOR: hand;" onclick="SortColumn(this,'+grDet.Name+'_Table_Rows,'+(i-(colSpanned-1))+',' + grDet.FreezeColumns + ');" ';
strInnerText += 'class="Grid_HeaderCellClass" ';
strInnerText+='>';
if (grDet.Columns[i].HeaderCheckBox=='1') {
strInnerText+='<INPUT Type="CheckBox" Name="' + grDet.Columns[i].Name + '_chkSelectAll'+k+'" Style="width=' + CHECKBOX_WIDTH + strUnit + ';"';
strInnerText+=' onclick="HCheckBox_Click(' + grDet.Columns[i].Name + '_chkSelectAll'+k+',' + grDet.Name + '_Table_Rows);';
if(grDet.Columns[i].OnHCheckboxClick!=''||grDet.Columns[i].OnHCheckboxClick!=null) strInnerText+=grDet.Columns[i].OnHCheckboxClick;
strInnerText+='" /> ';
}
strInnerText += currCaption;
}
strInnerText += '</td></tr></table>';
if(colSpanned
Shrikant Jadhav
June 8,