Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Raj Gupta on Aug 27, 2009 05:36
open dhtmlx forum
Header gets removed after i attached a footer to the grid.

Hi,

I am using a dhtmlxGrid. I am setting its header using 'setHeader' method, but when i call attachFooter and load xml , the header goes off.

Can you help me out of this situation. When i removed attachFooter method call, the header comes back. Is it a bug?

I am loading dataset using xmlstring with the help of command grdIncLog.loadXMLString(resultString[1].toString(), calculateFooterValuesIncLog);

Before loading , i call this( for footer):
grdIncLog.clearAll();
grdIncLog.detachFooter(0);
grdIncLog.attachFooter("Total number of log Entries:,#cspan,<div id='nr_q'>0</div>,#cspan", ["text-align:left;background-color:#D3E2E5;", "background-color:#D3E2E5;", "text-align:left;background-color:#D3E2E5;", "background-color:#D3E2E5;"]);

Please help me out, ASAP.

Thanks
Raj Gupta
Answer posted on Aug 27, 2009 09:05
Does your browser return any error when executin this code? Can you please provide us example where we can reproduce it?
Answer posted by Raj Gupta on Aug 28, 2009 01:44

Hi,

I am providing a sample code page, i think this issue is easily reproducible and I am not getting any javascript error from IE. Please help.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChildForm.aspx.cs" Inherits="com.northgate_is.iim.webeims.ui.ChildForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="Head1" runat="server">

<title>Child Form</title>

<!-- Add DHTMLX Control Stylesheets and skins - START -->

<link rel="stylesheet" type="text/css" href="codebase/dhtmlxlayout.css" />

<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxlayout_dhx_blue.css" />

<link rel="stylesheet" type="text/css" href="codebase/dhtmlxwindows.css" />

<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxwindows_dhx_blue.css" />

<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxgrid.css" />

<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxgrid_skins.css" />

<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxmenu_dhx_blue.css" />

<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxaccordion_dhx_blue.css"/>

<!-- Add DHTMLX Control Stylesheets and skins - END -->

<!-- Add DHTMLX libraries js files to be used in this module - START -->

<script type="text/javascript" src="codebase/dhtmlxlayout.js"></script>

<script type="text/javascript" src="codebase/dhtmlxcommon.js"></script>

<script type="text/javascript" src="codebase/dhtmlxwindows.js"></script>

<script type="text/javascript" src="codebase/dhtmlxgrid.js"></script>

<script type="text/javascript" src="codebase/dhtmlxgridcell.js"></script>

<script type="text/javascript" src="codebase/dhtmlxaccordion.js"></script>

<script type="text/javascript" src="codebase/ext/dhtmlxgrid_srnd.js"></script>

<!-- Add DHTMLX libraries js files to be used in this module - END -->

<style type="text/css">

.LabelIndicatorClass

{

margin:5pt;

border:1px;

border-style:solid;

font-family:Arial;

border-spacing:2px;

text-align:center;

width:75%;

font-weight:bold;

}

.grid_hover

{

background-color:#7FFFD4;

font-size:20px;

}

</style>

<script type="text/javascript">

var grdIncLog = null;

var xmlString = "<?xml version='1.0' encoding='UTF-8'?><rows><row style='color:Gray'><cell>23/07/2009 07:38:36</cell><cell>200018</cell><cell>200018</cell><cell>Address must be verified before Incident is Closed</cell><cell>1</cell></row><row style='color:Gray'><cell>23/07/2009 07:38:36</cell><cell>200018</cell><cell>200018</cell><cell>Incident Created from IIM</cell><cell>1</cell></row><row style='color:Gray'><cell>23/07/2009 07:43:38</cell><cell>Syscon</cell><cell>402</cell><cell>Overdue Time Reached</cell><cell>1</cell></row><row style='color:Black'><cell>25/08/2009 12:06:09</cell><cell>200014</cell><cell>MOBTERM</cell><cell>Tuesday 25 Aug 2009</cell><cell>2</cell></row><row style='color:Black'><cell>25/08/2009 12:06:09</cell><cell>200014</cell><cell>MOBTERM</cell><cell>THIS IS NEW TEST</cell><cell>2</cell></row></rows>";

function mainpageloadtest1() {

try {

// initialize the page layout body.

var dhxPageLayout = new dhtmlXLayoutObject("divParentId", "1C");

// initializing the body layout cells.

dhxPageLayout.cells("a").attachObject("divIncidentDetailsPage");

dhxPageLayout.cells("a").setText("Incidents Log List");

dhxPageLayout.cells("a").fixSize(false, true);

dhxPageLayout.cells("a").showHeader();

// Initialize incidents list grid.

if (grdIncLog == null)

grdIncLog = new dhtmlXGridObject('gridIncLog');

grdIncLog.setHeader("Date & Time,Operator,Terminal,Log Text, Acknowledged");

grdIncLog.setInitWidthsP("20,20,20,50,0")

grdIncLog.setColAlign("right,center,center,center,center");

grdIncLog.setColTypes("ro,ro,ro,ro,ro");

grdIncLog.setColSorting("str,int,str,str,na");

grdIncLog.setEditable(false);

grdIncLog.init();

grdIncLog.setSkin("light");

grdIncLog.enableAlterCss("even", "uneven");

if (xmlString != null && xmlString != "") {

grdIncLog.clearAll();

grdIncLog.detachFooter(0);

grdIncLog.attachFooter("Total number of log Entries:,#cspan,<div id='nr_q'>0</div>,#cspan,#cspan", ["text-align:left;background-color:#D3E2E5;", "background-color:#D3E2E5;", "text-align:left;background-color:#D3E2E5;", "background-color:#D3E2E5;"]);

grdIncLog.loadXMLString(xmlString, calculateFooterValuesIncLog);

}

}

catch (e) {

alert("You Got me: Error");

}

}

function calculateFooterValuesIncLog() {

var nrQ = document.getElementById('nr_q');

nrQ.innerHTML = grdIncLog.getRowsNum().toString();

grdIncLog.setHeader("Date & Time,Operator,Terminal,Log Text, Acknowledged");

}

function btnCancel_onclick() {

// Now close the window

if (parent.dhxWins.window("OI") != null) {

alert("yippie");

}

return true;

}

</script>

</head>

<body onload="mainpageloadtest1()">

<form id="form1" runat="server">

<!--DIVs contained in main body of the application-->

<div id="divParentId" style="position:absolute;margin:0px;top:0px;left:0px;width:900px;height:700px;overflow:hidden;">

</div>

<!-- DIV Incident Details Page - START -->

<div id="divIncidentDetailsPage">

<div id="gridIncLog" style="height:200px;"></div>

</div>

</form>

</body>

</html>