Printing the grid
I am trying to print the grid. If i try print preview in IE is see the headers, the rest of the page is blank and the number of pages is rapidly increasing... never stopping. I didn't dare real printing, but writing to a pdfwriter didn't work... . This problem does not occur in Firefox. Here is the code i use:
<?php
$userid = $_SESSION['user_id'];
$customerid = $_SESSION['customID'];
echo "<H2>Gebruikers</H2>\n";
//echo "<H2>".$itemnames['credentials_pheader_label']."</H2>\n";
//select the credentials of the logged in customer
$sql = "select * from CONTACT_PERSON where CP_REL_ID=".$customerid." order by CP_FIRSTNAME asc";
$result = exec_query($sql);
if($result != "") {
echo"
<div id=\"box\" style=\"height:25%;width:90%;\">
<div style=\"padding:0px 50px\">
<div class=\"line\"> </div>
<div class=\"line2\">Laden van data...</div>
<div class=\"loading\"></div>
</div>
</div>";
$columns = "[
\"".$itemnames['credentials_person_firstname_label']."\",
\"".$itemnames['credentials_person_lastname_label']."\",
\"".$itemnames['credentials_person_gender_label']."\",
\"".$itemnames['credentials_person_email_label']."\",
\"".$itemnames['credentials_person_loginname_label']."\",
\"Gebruiker type\",
\"Geblokkeerd\"];";
$data = "";
while($resultarray = ibase_fetch_object($result)) {
$blocked = $resultarray->CP_BLOCKED;
if($blocked==0) {
$blocked = "Nee";
}
else {
$blocked = "Ja";
}
$usertype= $resultarray->CP_POWERUSER;
if($usertype==0) {
$usertype="Gebruiker";
}
else if($usertype==1) {
$usertype="Coordinator";
}
else {
$userype="Hoger dan 1";
}
if($data=="") {
$data .= "[";
}
else {
$data .= ",";
}
$data .= "[
\"".$resultarray->CP_FIRSTNAME."\",
\"".$resultarray->CP_LASTNAME."\",
\"".$resultarray->CP_GENDER."\",
\"".$resultarray->CP_EMAIL."\",
\"".$resultarray->CP_LOGINNAME."\",
\"".$usertype."\",
\"".$blocked."\"]";
}
$data.="];";
echo "
<link href=\"./xp/aw.css\" rel=\"stylesheet\" type=\"text/css\" ></link>
<script src=\"./aw.js\"></script>
<script>
var obj = new AW.UI.Grid;
var myData = ".$data."
var myColumns = ".$columns."
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);
// enable row selectors
obj.setSelectorVisible(false);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
// set row selection
obj.setSelectionMode(\"single-row\");
obj.setSelectorVisible(false);
obj.setCellEditable(false);
// write grid html to the page
window.setTimeout(function(){
try {
document.getElementById(\"box\").innerHTML = obj;
}
catch(e){
}
}, 100);
</script>";
echo "<style>
.aw-grid-control {height: 100%; width: 100%; margin: 0px; border: none; font: menu;}
.aw-row-selector {text-align: center}
.aw-column-0 {width: 80px;}
.aw-column-1 {width: 150px;}
.aw-grid-cell {border-right: 1px solid threedlightshadow;}
.aw-grid-row {border-bottom: 1px solid threedlightshadow;}
.aw-alternate-even {background: #fff;}
.aw-alternate-odd {background: #eee;}
.aw-rows-selected {background: #316ac5;}
</style>";
}
else {
echo "Geen gebruikers gevonden";
}
echo"
<br /><div id=\"print\"><a href=\"javascript:window.print()\" class=\"print\">Print deze pagina</a></div>";
?>
<?php
$userid = $_SESSION['user_id'];
$customerid = $_SESSION['customID'];
echo "<H2>Gebruikers</H2>\n";
//echo "<H2>".$itemnames['credentials_pheader_label']."</H2>\n";
//select the credentials of the logged in customer
$sql = "select * from CONTACT_PERSON where CP_REL_ID=".$customerid." order by CP_FIRSTNAME asc";
$result = exec_query($sql);
if($result != "") {
echo"
<div id=\"box\" style=\"height:25%;width:90%;\">
<div style=\"padding:0px 50px\">
<div class=\"line\"> </div>
<div class=\"line2\">Laden van data...</div>
<div class=\"loading\"></div>
</div>
</div>";
$columns = "[
\"".$itemnames['credentials_person_firstname_label']."\",
\"".$itemnames['credentials_person_lastname_label']."\",
\"".$itemnames['credentials_person_gender_label']."\",
\"".$itemnames['credentials_person_email_label']."\",
\"".$itemnames['credentials_person_loginname_label']."\",
\"Gebruiker type\",
\"Geblokkeerd\"];";
$data = "";
while($resultarray = ibase_fetch_object($result)) {
$blocked = $resultarray->CP_BLOCKED;
if($blocked==0) {
$blocked = "Nee";
}
else {
$blocked = "Ja";
}
$usertype= $resultarray->CP_POWERUSER;
if($usertype==0) {
$usertype="Gebruiker";
}
else if($usertype==1) {
$usertype="Coordinator";
}
else {
$userype="Hoger dan 1";
}
if($data=="") {
$data .= "[";
}
else {
$data .= ",";
}
$data .= "[
\"".$resultarray->CP_FIRSTNAME."\",
\"".$resultarray->CP_LASTNAME."\",
\"".$resultarray->CP_GENDER."\",
\"".$resultarray->CP_EMAIL."\",
\"".$resultarray->CP_LOGINNAME."\",
\"".$usertype."\",
\"".$blocked."\"]";
}
$data.="];";
echo "
<link href=\"./xp/aw.css\" rel=\"stylesheet\" type=\"text/css\" ></link>
<script src=\"./aw.js\"></script>
<script>
var obj = new AW.UI.Grid;
var myData = ".$data."
var myColumns = ".$columns."
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(myData.length);
obj.setColumnCount(myColumns.length);
// enable row selectors
obj.setSelectorVisible(false);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
// set row selection
obj.setSelectionMode(\"single-row\");
obj.setSelectorVisible(false);
obj.setCellEditable(false);
// write grid html to the page
window.setTimeout(function(){
try {
document.getElementById(\"box\").innerHTML = obj;
}
catch(e){
}
}, 100);
</script>";
echo "<style>
.aw-grid-control {height: 100%; width: 100%; margin: 0px; border: none; font: menu;}
.aw-row-selector {text-align: center}
.aw-column-0 {width: 80px;}
.aw-column-1 {width: 150px;}
.aw-grid-cell {border-right: 1px solid threedlightshadow;}
.aw-grid-row {border-bottom: 1px solid threedlightshadow;}
.aw-alternate-even {background: #fff;}
.aw-alternate-odd {background: #eee;}
.aw-rows-selected {background: #316ac5;}
</style>";
}
else {
echo "Geen gebruikers gevonden";
}
echo"
<br /><div id=\"print\"><a href=\"javascript:window.print()\" class=\"print\">Print deze pagina</a></div>";
?>
Rik Smith
October 24,