Forum


06:25

11/11/2009

Hello all,
Althoght I'm a long time java programmer, I've just started with javascript, jquery and jqgrid.
I'm trying to implement jqgrid in one application and I'm having some problems. Sure it will be an stupidity but I've been some days trying to find by myself what's happening and cannot find it.
This is my first grid (code below). Html page loads ok, and in firefox everything works fine, but not in IExplorer neither GoogleChrome. In IE/chrome I get the jqgrid correctly displayed but is not filled with data. I see the call to server (java servlet) in my logs and the xml output data is served back to jqgrid/jquery, but never displayed.
I've tried to server the xml with different content types (I guess it must be "Content-type: text/xml;charset=utf-8" , or, in my case ISO-8859-15) but I've also tried with text/html without success.
The error I see in IExplorer (v6 and v8) is an 'Object required' in jquery-1.3.2.min.js line 12 char 7209 , and in that point I see:
return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)
The code: html/javascript:
-----------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>jqGrid test</title>
<link rel="stylesheet" type="text/css" media="screen" href="/scanciax/css/cupertino/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/scanciax/css/ui.jqgrid.css" />
<script src="/scanciax/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/scanciax/js/i18n/grid.locale-sp.js" type="text/javascript"></script>
<script src="/scanciax/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery().ready(function(){
jQuery("#list").jqGrid({
url:'/scanciax/servlet/lwasScancia?vsPage=jqdataPersonas',
datatype: "xml",
mtype: 'GET',
colNames:['id','Nombre','Apellido 1', 'Apellido 2', 'Tratamiento'],
colModel :[
{name:'idpersona', index:'idpersona', width:1,hidden:true},
{name:'snombre', index:'snombre', width:155, align:'left' , sortable:true},
{name:'sapellido1', index:'sapellido1', width:90, align:'right', sortable:true},
{name:'sapellido2', index:'sapellido2', width:380, align:'right', sortable:true},
{name:'idtratamiento', index:'idtratamiento', width:10, align:'right', sortable:false }
],
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,50,100,250,500],
sortname: 'sapellido1',
sortorder: "asc",
imgpath: 'themes/basic/images',
caption: 'My test grid'
});
});
</script>
</head>
<body>
<table width="100%" id="list" class="scroll"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------
Sample XML data served by the url "/scanciax/servlet/lwasScancia?vsPage=jqdataPersonas" is as follows:
-----------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-15"?>
<rows>
<page>1</page>
<total>363</total>
<records>3621</records>
<row id="3047">
<cell>3047</cell>
<cell>PAUL</cell>
<cell>- OTTO FASSBENDER</cell>
<cell></cell>
<cell>-1</cell>
</row>
<row id="2693">
<cell>2693</cell>
<cell>SERVICIO</cell>
<cell>A</cell>
<cell></cell>
<cell>-1</cell>
</row>
10:47

11/11/2009

02:37

I'm having the exact same problem as you and I don't quite understand how you fixed the xml error. My code for my php code that builds the XML data looks like:
. . .
// we should set the appropriate header information
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");
}
echo "<?xml version='1.0' encoding='utf-8'?>";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$total_pages."</total>";
echo "<records>".$rowCt."</records>";
foreach ($result as $row)
{
echo "<row id='".$row->PART_ID."'>";
echo "<cell><![CDATA[".$row->PART_ID."]]></cell>";
echo "<cell><![CDATA[".$row->EAU."]]></cell>";
echo "<cell><![CDATA[".$row->MINPER."]]></cell>";
echo "<cell><![CDATA[".$row->NOTIFY."]]></cell>";
echo "<cell><![CDATA[".$row->STATUS."]]></cell>";
echo "</row>";
}
echo "</rows>";
. . .
Do you have any suggestions?
10:38

08/01/2010

18:19

Moderators
30/10/2007

Hello,
Jeff, What does not work exactley for you?
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:
46 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