I tried to export a datagrid into excel file but I get a blank page. Here is my code:
<?php
require "KoolControls/KoolGrid/koolgrid.php";
require "KoolControls/KoolAjax/koolajax.php";
$koolajax->scriptFolder = "KoolControls/KoolAjax";
require "KoolControls/KoolGrid/ext/datasources/MySQLiDataSource.php";
$db_con = mysql_connect('localhost','r51945ztea_admin','zteparola1');
mysql_select_db("r51945ztea_zte", $db_con);
$ds= new MySQLDataSource($db_con);
$ds->SelectCommand = "SELECT `id`,`TAS`, `request`, `phone_number`, `comments`, `coordinator`, `technician_date`, `Status` from technician";
$ds->UpdateCommand = "update technician set comments='@comments', coordinator='@coordinator', Status='@Status' where id='@id'";
$gridTech = new KoolGrid("gridTech");
$gridTech->scriptFolder = "KoolControls/KoolGrid";
$gridTech->styleFolder="sunset";
$gridTech->AjaxEnabled = true;
$gridTech->AjaxLoadingImage = $KoolControlsFolder."/KoolAjax/loading/5.gif";
$gridTech->DataSource = $ds;
$gridTech->MasterTable->Pager = new GridPrevNextAndNumericPager();
$gridTech->Width = "1500px";
$gridTech->ColumnWrap = true;
$gridTech->AllowEditing = true;
$gridTech->RowAlternative = true;
$gridTech->MasterTable->Pager->PageSize = 10;
$column = new GridBoundColumn();
$column->DataField = "id";
$column->ReadOnly = true;
$column->Visible = false;
$gridTech->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "TAS";
$column->HeaderText = "TAS";
$column->ReadOnly = true;
$gridTech->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "request";
$column->HeaderText = "Request";
$column->ReadOnly = true;
$gridTech->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "phone_number";
$column->HeaderText = "Phone Number";
$column->ReadOnly = true;
$gridTech->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "coordinator";
$column->HeaderText = "Coordinator";
$gridTech->MasterTable->AddColumn($column);
$column = new GridTextAreaColumn();
$column->DataField = "comments";
$column->HeaderText = "Comments";
$column->Width = "200px";
$gridTech->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "technician_date";
$column->HeaderText = "Date";
$column->Width = "180px";
$column->ReadOnly = true;
$gridTech->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "Status";
$column->HeaderText = "Status";
$column->AddItem("Open");
$column->AddItem("Closed");
$column->Sort = -1;
$gridTech->MasterTable->AddColumn($column);
$column = new GridEditDeleteColumn();
$column->ShowDeleteButton = false;
$column->Align = "center";
$gridTech->MasterTable->AddColumn($column);
$gridTech->MasterTable->EditSettings->Mode = "Inline";
$gridTech->Process();
if(isset($_POST["IgnorePaging"]))
{
$gridTech->ExportSettings->IgnorePaging = true;
}
if(isset($_POST["ExportToExcel"]))
{
ob_end_clean();
$gridTech->GetInstanceMasterTable()->ExportToExcel();
}
?>
<script type="text/javascript">
setInterval(function(){
gridTech.refresh();
gridTech.commit();
}, 300000);
</script>
<?php
$db_con = mysql_connect('localhost','r51945ztea_admin','zteparola1');
mysql_select_db("r51945ztea_zte", $db_con);
$ds= new MySQLDataSource($db_con);
$ds->SelectCommand = "SELECT `id`, `station_name`, `request`, `phone_number`, `comments`, `coordinator`, `konfig_date`, `Status` from konfig";
$ds->UpdateCommand = "update konfig set comments='@comments', coordinator='@coordinator', Status='@Status' where id='@id'";
$gridKonfig = new KoolGrid("gridKonfig");
$gridKonfig->scriptFolder = "KoolControls/KoolGrid";
$gridKonfig->styleFolder="sunset";
$gridKonfig->AjaxEnabled = true;
$gridKonfig->DataSource = $ds;
$gridKonfig->MasterTable->Pager = new GridPrevNextAndNumericPager();
$gridKonfig->Width = "1500px";
$gridKonfig->ColumnWrap = true;
$gridKonfig->AllowEditing = true;
$gridKonfig->RowAlternative = true;
$gridKonfig->MasterTable->Pager->PageSize = 10;
$column = new GridBoundColumn();
$column->DataField = "id";
$column->ReadOnly = true;
$column->Visible = false;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "station_name";
$column->HeaderText = "Station Name";
$column->ReadOnly = true;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "request";
$column->HeaderText = "Request";
$column->ReadOnly = true;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "phone_number";
$column->HeaderText = "Phone Number";
$column->ReadOnly = true;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "coordinator";
$column->HeaderText = "Coordinator";
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridTextAreaColumn();
$column->DataField = "comments";
$column->HeaderText = "Comments";
$column->Width = "200px";
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "konfig_date";
$column->HeaderText = "Date";
$column->Width = "180px";
$column->ReadOnly = true;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "Status";
$column->HeaderText = "Status";
$column->AddItem("Open");
$column->AddItem("Closed");
$column->Sort = -1;
$gridKonfig->MasterTable->AddColumn($column);
$column = new GridEditDeleteColumn();
$column->ShowDeleteButton = false;
$column->Align = "center";
$gridKonfig->MasterTable->AddColumn($column);
$gridKonfig->MasterTable->EditSettings->Mode = "Inline";
$gridKonfig->Process();
if(isset($_POST["IgnorePaging"]))
{
$gridKonfig->ExportSettings->IgnorePaging = true;
}
if(isset($_POST["ExportToExcel"]))
{
ob_end_clean();
$gridKonfig->GetInstanceMasterTable()->ExportToExcel();
}
?>
<script type="text/javascript">
setInterval(function(){
gridKonfig.refresh();
gridKonfig.commit();
}, 300000);
</script>
<?php
$db_con = mysql_connect('localhost','r51945ztea_admin','zteparola1');
mysql_select_db("r51945ztea_zte", $db_con);
$ds= new MySQLDataSource($db_con);
$ds->SelectCommand = "SELECT `id`, `CRQ`, `station_name`, `phone_number`, `comments`, `coordinator`, `other_date`, `Status` FROM other_bo ";
$ds->UpdateCommand = "update other_bo set comments='@comments', coordinator='@coordinator', Status='@Status' where id='@id'";
$gridOther = new KoolGrid("gridOther");
$gridOther->scriptFolder = "KoolControls/KoolGrid";
$gridOther->styleFolder="sunset";
$gridOther->AjaxEnabled = true;
$gridOther->DataSource = $ds;
$gridOther->MasterTable->Pager = new GridPrevNextAndNumericPager();
$gridOther->Width = "1500px";
$gridOther->ColumnWrap = true;
$gridOther->AllowEditing = true;
$gridOther->RowAlternative = true;
$gridOther->MasterTable->Pager->PageSize = 10;
$column = new GridBoundColumn();
$column->DataField = "id";
$column->ReadOnly = true;
$column->Visible = false;
$gridOther->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "CRQ";
$column->HeaderText = "CRQ";
$column->ReadOnly = true;
$gridOther->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "station_name";
$column->HeaderText = "Station Name";
$column->ReadOnly = true;
$gridOther->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "phone_number";
$column->HeaderText = "Phone Number";
$column->ReadOnly = true;
$gridOther->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "coordinator";
$column->HeaderText = "Coordinator";
$gridOther->MasterTable->AddColumn($column);
$column = new GridTextAreaColumn();
$column->DataField = "comments";
$column->HeaderText = "Comments";
$column->Width = "200px";
$gridOther->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "other_date";
$column->HeaderText = "Date";
$column->Width = "180px";
$column->ReadOnly = true;
$gridOther->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "Status";
$column->HeaderText = "Status";
$column->AddItem("Open");
$column->AddItem("Closed");
$column->Sort = -1;
$gridOther->MasterTable->AddColumn($column);
$column = new GridEditDeleteColumn();
$column->ShowDeleteButton = false;
$column->Align = "center";
$gridOther->MasterTable->AddColumn($column);
$gridOther->MasterTable->EditSettings->Mode = "Inline";
$gridOther->Process();
if(isset($_POST["IgnorePaging"]))
{
$gridOther->ExportSettings->IgnorePaging = true;
}
if(isset($_POST["ExportToExcel"]))
{
ob_end_clean();
$gridOther->GetInstanceMasterTable()->ExportToExcel();
}
?>
<script type="text/javascript">
setInterval(function(){
gridOther.refresh();
gridOther.commit();
}, 300000);
</script>
<?php
$db_con = mysql_connect('localhost','r51945ztea_admin','zteparola1');
mysql_select_db("r51945ztea_zte", $db_con);
$ds= new MySQLDataSource($db_con);
$ds->SelectCommand = "SELECT `id`, `CRQ`, `station_name`, `phone_number`, `comments`, `coordinator`, `abel_date`, `Status` FROM abel_bo ";
$ds->UpdateCommand = "update abel_bo set comments='@comments', coordinator='@coordinator', Status='@Status' where id='@id'";
$gridAbel = new KoolGrid("gridAbel");
$gridAbel->scriptFolder = "KoolControls/KoolGrid";
$gridAbel->styleFolder="sunset";
$gridAbel->AjaxEnabled = true;
$gridAbel->DataSource = $ds;
$gridAbel->MasterTable->Pager = new GridPrevNextAndNumericPager();
$gridAbel->Width = "1500px";
$gridAbel->ColumnWrap = true;
$gridAbel->AllowEditing = true;
$gridAbel->RowAlternative = true;
$gridAbel->MasterTable->Pager->PageSize = 10;
$column = new GridBoundColumn();
$column->DataField = "id";
$column->ReadOnly = true;
$column->Visible = false;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "CRQ";
$column->HeaderText = "CRQ";
$column->ReadOnly = true;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "station_name";
$column->HeaderText = "Station Name";
$column->ReadOnly = true;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "phone_number";
$column->HeaderText = "Phone Number";
$column->ReadOnly = true;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "coordinator";
$column->HeaderText = "Coordinator";
$gridAbel->MasterTable->AddColumn($column);
$column = new GridTextAreaColumn();
$column->DataField = "comments";
$column->HeaderText = "Comments";
$column->Width = "200px";
$gridAbel->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "abel_date";
$column->HeaderText = "Date";
$column->Width = "180px";
$column->ReadOnly = true;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "Status";
$column->HeaderText = "Status";
$column->AddItem("Open");
$column->AddItem("Closed");
$column->Sort = -1;
$gridAbel->MasterTable->AddColumn($column);
$column = new GridEditDeleteColumn();
$column->ShowDeleteButton = false;
$column->Align = "center";
$gridAbel->MasterTable->AddColumn($column);
$gridAbel->MasterTable->EditSettings->Mode = "Inline";
$gridAbel->Process();
if(isset($_POST["IgnorePaging"]))
{
$gridAbel->ExportSettings->IgnorePaging = true;
}
if(isset($_POST["ExportToExcel"]))
{
ob_end_clean();
$gridAbel->GetInstanceMasterTable()->ExportToExcel();
}
?>
<script type="text/javascript">
setInterval(function(){
gridAbel.refresh();
gridAbel.commit();
}, 300000);
</script>
<html>
<head>
<title></title>
<?php echo $koolajax->Render();?>
<style >
body {
background-color: #e3e3e3;
}
.container {
background-color: #e3e3e3;
width: 98%;
height: 965px;
margin: auto;
display: block;
position: relative;
}
.wrapper {
padding: 0px 47px 12px 22px;
}
.tech {
float: left;
}
.konfig {
float: left;
}
.abelBo {
float: left;
}
.otherBo {
float: left;
}
.row {
}
h3 {
text-align: center;
padding-bottom: 10px;
}
</style>
</head>
<body>
<div id="container" class="container">
<div class="row">
<div class="wrapper tech" id="technician">
<h3>Technician</h3>
<form id="techGrid" method="post">
<?php echo $koolajax->Render();?>
<div style="margin-bottom:10px;padding:10px;width:635px;background:#e3e3e3;border:solid 1px #e3e3e3;">
<input type="checkbox" id="IgnorePaging" name="IgnorePaging"/> <label for="IgnorePaging">Ignore Paging</label>
<br/><br/>
<input type="submit" name="ExportToExcel" value = "Export to Excel" />
</div>
<?php echo $gridTech->Render();?>
</form>
</div>
</div>
<div class="row">
<div class="wrapper konfig" id="konfig">
<h3>Konfig</h3>
<form id="konfigGrid" method="post">
<?php echo $gridKonfig->Render();?>
</form>
</div>
</div>
<div class="row">
<div class="wrapper abelBo" id="abel">
<h3>External BO (Nokia/Huawei/Abel..)</h3>
<form id="abelBoGrid" method="post">
<?php echo $gridAbel->Render();?>
</form>
</div>
</div>
<div class="row">
<div class="wrapper otherBo" id="other">
<h3>Other</h3>
<form id="otherBoGrid" method="post">
<?php echo $gridOther->Render();?>
</form>
</div>
</div>
</div>
</body>
</html>