Forum


04:50

19/06/2009

Hi,
i've got a problem with jgrid in ie.
In FF jgrid show me all informations from my Database correctly, but the IE doesn't.
The IE only shows the load Icon:
http://d21.udmedia.de/gridtest/
My Script:
[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>grid Test</title>
<!-- Load jQuery Theme -->
<link rel="stylesheet" type="text/css" media="screen" href="plugins/jquery_ui/css/redmond/jquery-ui-1.7.2.custom.css" />
<!-- Load jQuery bib -->
<script src="libs/jquery-1.3.2.min.js" type="text/javascript"></script>
<!-- menu slider -->
<script src="scripts/menu.js" type="text/javascript"></script>
<!-- jQuery Grid -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/design.css" />
<link rel="stylesheet" type="text/css" media="screen" href="plugins/jquerygrid/css/ui.jqgrid.css" />
<script src="plugins/jquerygrid/js/i18n/grid.locale-de.js" type="text/javascript"></script>
<script src="plugins/jquerygrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'functions/grid.php',
datatype: 'xml',
mtype: 'GET',
colNames:['Nr.','Betreff', 'Status','Geöffnet','Fähigkeit','Bearbeiter'],
colModel :[
{name:'number', index:'number', width:55},
{name:'subject', index:'subject', width:90},
{name:'status', index:'status', width:80, align:'right'},
{name:'open', index:'open', width:80, align:'right'},
{name:'ability', index:'ability', width:80, align:'right'},
{name:'editor', index:'editor', width:150}
],
rowNum:10,
rowList:[10,20,30],
pager: jQuery('#pager'),
sortname: 'number',
sortorder: "desc",
viewrecords: true,
autowidth: true,
imgpath: 'plugins/jquery_ui/css/redmond/images',
caption: 'Offene Zeitstempel'
});
});
</script>
<!-- jQuery Grid -->
</head>
<body>
<div id="container">
<!-- Header -->
<?php include('header.php'); ?>
<!-- Main Menü -->
<?php include('mainMenu.php'); ?>
<div id="content">
<!-- Content -->
<table id="list" class="scroll"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</div>
</div>
</body>
</html>
[PHP]
<?php
include("dbconf");
$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
if(!$sidx) $sidx =1;
// connect to the database
$db = mysql_connect($dbhost, $dbuser, $dbpassword)
or die("Connection Error: " . mysql_error());
mysql_select_db($database) or die("Error conecting to db.");
$result = mysql_query("SELECT COUNT(*) AS count FROM grid");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count >0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$SQL = "SELECT number, subject, status, open, ability, editor FROM grid ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL );
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml;charset=utf-8"); } else {
header("Content-type: text/xml;charset=utf-8");
}
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$et\\n";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$total_pages."</total>";
echo "<records>".$count."</records>";
// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row id='". $row[number]."'>";
echo "<cell>". $row[number]."</cell>";
echo "<cell><![CDATA[". $row[subject]."]]></cell>";
echo "<cell>". $row[status]."</cell>";
echo "<cell>". $row[open]."</cell>";
echo "<cell><![CDATA[". $row[ability]."]]></cell>";
echo "<cell><![CDATA[". $row[editor]."]]></cell>";
echo "</row>";
}
echo "</rows>";
?>
Thanks for your help.
Greetings - MsvP
06:31

Moderators
30/10/2007

Hello,
In FireFox, Safari and Chrome browsers I see wrong German charcters (umlauts and others), which mean that you server side code does not send the appropriate headers.
In IE is not working at all.
Also please be sure.
1. html page is utf-8
2. your database is utf-8 and before the query you do (in MySQL)
SET NAMES utf8
3. use the header in php to send the utf 8
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
35 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66