Forum
01:18
19/11/2012
I'm so frustrated. Been searching examples and forums for 3 days trying to get a tree grid to show.
Any help would be so appreciated.
Here is my header:
<link rel="stylesheet" type="text/css" media="screen" href="css/smoothness/jquery-ui-1.9.1.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery.ui.accordion.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/searchFilter.css" />
<style>
body {font-size:10px;
}
</style>
<script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.9.1.custom.min.js"></script>
<script src="js/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
Here is my body:
<div id="wrapper" style="background-color:#FFFFFF">
<div id="dtables" style="width:50%;float:left;">
<h3>Tables</h3>
<div id="tblOutput">
<table id="gridPeople"></table>
<div id="plist485"></div>
<table id="gridProduct"></table>
<table id="gridProcess"></table>
<table id="gridPerformance"></table>
</div>
<h3>Status</h3>
<div>
</div>
</div>
<div id="gauges" style="width:50%;float:right">
</div>
</div>
Here is my script:
jQuery.extend($.fn.fmatter , {
PointFmatter : function(cellvalue, options, rowdata) {
if (cellvalue > 90) {
return '<span style="color:blue;">' + cellvalue + '</span>';
} else if (cellvalue > 80) {
return '<span style="color:green;">' + cellvalue + '</span>';
} else if (cellvalue > 70) {
return '<span style="color:orange;">' + cellvalue + '</span>';
} else {
return '<span style="color:red;">' + cellvalue + '</span>';
}
}
});
jQuery("#gridPeople").jqGrid({
treeGrid: true,
treeGridModel: 'adjacency',
url:'data/people_995.xml',
datatype: "xml",
ExpandColumn : 'Subjectname',
height: 'auto',
// hiddengrid: true,
colNames:['id','Subject','measure','Week', 'MTD', 'QTD','YTD'],
viewRecords:true,
colModel:[
{name:'id', index:'id', hidden:true,key:true},
{name:'Subjectname',index:'Subjectname', width:140},
{name:'SubSubjectName',index:'SubSubjectName', width:140, align:'right'},
{name:'WTD',index:'WTD', width:60, align:'center', sorttype:'float',formatter:'PointFmatter'},
{name:'MTD',index:'MTD', width:60, align:'center', sorttype:'float',formatter:'PointFmatter'},
{name:'QTD',index:'QTD', width:60, align:'center', sorttype:'float',formatter:'PointFmatter'},
{name:'YTD',index:'YTD', width:60, align:'center', sorttype:'float',formatter:'PointFmatter'}
],
caption: "<span style='margin-left:20px'>People</span>"
});
And here is my xml:
<?xml version="1.0″?>
<Rows>
<page>1</page>
<total>2</total>
<records>6</records>
<Row id="1″>
<Subjectname>Motor Vehicle Incidents</Subjectname>
<SubSubjectName> </SubSubjectName>
<WTD>70</WTD>
<MTD>75</MTD>
<QTD>80</QTD>
<YTD >81</YTD>
<level>0</level>
<parent></parent>
<isLeaf>false</isLeaf>
<expanded>false</expanded>
</Row>
<Row id="2″>
<Subjectname>Motor Vehicle Incidents</Subjectname>
<SubSubjectName>Motor Vehicle Incidents</SubSubjectName>
<WTD>0</WTD>
<MTD>0</MTD>
<QTD>0</QTD>
<YTD>0</YTD>
<level>1</level>
<parent>1</parent>
<isLeaf>true</isLeaf>
<expanded>false</expanded>
</Row>
<Row id="3″>
<Subjectname>OSHA Incidents</Subjectname>
<SubSubjectName/>
<WTD>0</WTD>
<MTD>0</MTD>
<QTD>0</QTD>
<YTD>0</YTD>
<level>0</level>
<parent></parent>
<isLeaf>false</isLeaf>
<expanded>false</expanded>
</Row>
<Row id="4″>
<Subjectname>OSHA Incidents</Subjectname>
<SubSubjectName>OSHA Incidents</SubSubjectName>
<WTD>0</WTD>
<MTD>0</MTD>
<QTD>0</QTD>
<YTD>0</YTD>
<level>1</level>
<parent>3</parent>
<isLeaf>true</isLeaf>
<expanded>false</expanded>
</Row>
<Row id="5″>
<Subjectname>Vacant Rate F1, 2B, 4</Subjectname>
<SubSubjectName/>
<WTD>0</WTD>
<MTD>0</MTD>
<QTD>0</QTD>
<YTD>0</YTD>
<level>0</level>
<parent></parent>
<isLeaf>false</isLeaf>
<expanded>false</expanded>
</Row>
<Row id="6″>
<Subjectname>Vacant Rate F1, 2B, 4</Subjectname>
<SubSubjectName>Vacant Rate F1, 2B, 4</SubSubjectName>
<WTD>0</WTD>
<MTD>0</MTD>
<QTD>0</QTD>
<YTD>0</YTD>
<level>1</level>
<parent>5</parent>
<isLeaf>true</isLeaf>
<expanded>false</expanded>
</Row>
</Rows>
Most Users Ever Online: 715
Currently Online:
38 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