Forum



17:16

06/07/2012

Hello
I am at my wits end. I have read (and seen examples) on how to load a static xml file into jqgrid, but for the life of me I cannot make it work. The list doesn't have to be edited or rows deleted, just viewed locally. I am useing another program to edit the xml file when needed.
here is the html code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DT.....strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Approved Personnel List</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/aja.....ery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jq.....jqgrid.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/aja.....lt;/script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jq.....lt;/script>
<style type="text/css">
span.cellWithoutBackground
{
display:block;
background-image:none;
margin-right:-2px;
margin-left:-2px;
height:14px;
padding:4px;
}
</style>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
var grid = $("#list");
prmSearch={multipleSearch:false,overlay:false};
grid.jqGrid({
url:'Book3.xml',
datatype: "xml",
colNames:['id','company', 'base', 'Name','traindate','expire','type'],
colModel: [
{name:'id',index:'id',width:30,align:'center',sorttype: 'int',searchoptions:{sopt:['eq','ne']},xmlmap:"id"},
{name:'company',index:'company', width:120,searchoptions:{sopt:['cn','nc']},xmlmap:"company"},
{name:'base',index:'base', width:40, align:'center',editrules:{required:true},searchoptions:{sopt:['cn','nc']},xmlmap:"base"},
{name:'Name',index:'Name', width:150, editrules:{required:true},searchoptions:{sopt:['cn','nc']},xmlmap:"Name"},
{name:'traindate',index:'traindate',width:80, align:'center', sorttype:'date',formatter:'date', formatoptions: {newformat:'d-M-Y'},xmlmap:"traindate"},
{name:'expire',index:'expire',width:80, align:'center', sorttype:'date',formatter:'date', formatoptions: {newformat:'d-M-Y'},xmlmap:"expire"},
{name:'type',index:'type',width:100,align:'center',
stype:"select", searchoptions:{value:':All;Line AOG:Line AOG;Elem Work:Elem Work;Eyes Only:Eyes Only;MEL & Service:MEL & Service;Heavy Maint:Heavy
Maint;Expired:Expired'},
formatter: function (cellvalue) {
var color;
if (cellvalue=="Expired") {
color = '#ff0000';
} else if (cellvalue=="Elem Work") {
color = '#ffff00';
}
else if (cellvalue=="MEL & Service") {
color = '#ff8000';
}
return '<span class="cellWithoutBackground" style="background:' + color + ';">' + cellvalue + '</span>';
},xmlmap:"type"},
],
pager: '#pager',
xmlReader:{
root:"Aoglist",
row:"employee",
repeateitems: false
},
rowNum: 15,
rowList: [5, 10, 20, 50],
rownumbers:true,
ignoreCase:true,
sortname: 'id',
sortorder: 'ascend',
viewrecords: true,
height: "100%",
caption: "Approved Personnel List ",
});
grid.jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:true,refresh:true},
{},{},{},prmSearch);
grid.searchGrid(prmSearch);
var searchDialog = $("#fbox_"+grid[0].id);
searchDialog.addClass("ui-jqgrid ui-widget ui-widget-content ui-corner-all");
searchDialog.css({position:"relative", "z-index":"200", float:"left"})
var gbox=$("#gbox_"+grid[0].id);
gbox.before(searchDialog);
gbox.css({clear:"left"});
});
//]]>
</script>
</head>
<body>
<table id="list"><tbody><tr><td /></tr></tbody></table>
<div id="pager" />
</body>
</html>
and here is the xml file that I am trying to load:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Aoglist>
<employee>
<id>1</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Doninic Breton</Name>
<traindate>40340</traindate>
<expire>41436</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>2</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Kirk Willis</Name>
<traindate>40406</traindate>
<expire>41502</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>3</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Khalid Arcand</Name>
<traindate>40406</traindate>
<expire>41502</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>4</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Gabe Fragassi</Name>
<traindate>40406</traindate>
<expire>41502</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>5</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Erik Zours</Name>
<traindate>40406</traindate>
<expire>41502</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>6</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Frank Hart</Name>
<traindate>40408</traindate>
<expire>41504</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>7</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Moiz Tahir</Name>
<traindate>40408</traindate>
<expire>41504</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>8</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Terry Wlad</Name>
<traindate>40408</traindate>
<expire>41504</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>9</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Dean Pretty</Name>
<traindate>40408</traindate>
<expire>41504</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>10</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Brian Fletcher</Name>
<traindate>40415</traindate>
<expire>41511</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>11</id>
<company>Air Creebec</company>
<base>YTS</base>
<Name>Steve Smeltzer</Name>
<traindate>40415</traindate>
<expire>41511</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>12</id>
<company>Air Creebec</company>
<base>YVO</base>
<Name>Art Wargala</Name>
<traindate>40434</traindate>
<expire>41530</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>13</id>
<company>AvMax</company>
<base>YYC</base>
<Name>Paul Fitzpatrick</Name>
<traindate>41008</traindate>
<expire>42103</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>14</id>
<company>AvMax</company>
<base>YYC</base>
<Name>Edwin Kho</Name>
<traindate>41008</traindate>
<expire>42103</expire>
<type>Line AOG</type>
</employee>
<employee>
<id>15</id>
<company>AvMax</company>
<base>YYC</base>
<Name>Ed Storey</Name>
<traindate>41008</traindate>
<expire>42103</expire>
<type>Line AOG</type>
</employee>
</Aoglist>
Does anyone have any idea of what I am doing wrong?
Thank you so much in advance
Wayne
Most Users Ever Online: 715
Currently Online:
42 Guest(s)
Currently Browsing this Page:
2 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