-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
124 lines (124 loc) · 7.46 KB
/
Copy pathtest.html
File metadata and controls
124 lines (124 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<html>
<head>
<!-- add the jQuery script -->
<script src="https://code.jquery.com/jquery-1.11.1.min.js" integrity="sha256-VAvG3sHdS5LqTT+5A/aeq/bZGa/Uj04xKxY8KM/w9EE=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"><!-- Optional theme --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"><link rel="stylesheet" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqx.base.css" ><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxcore.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxdata.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxbuttons.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxscrollbar.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxmenu.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxgrid.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxgrid.selection.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxgrid.filter.js" ></script><script type="text/javacript" href="https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/jqxgrid.sort.js" ></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function () {
var url = "https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/employees.xml";
var source =
{
datafields: [
{ name: 'FirstName' },
{ name: 'LastName' },
{ name: 'Title' },
{ name: 'Address' },
{ name: 'City' }
],
root: "Employees",
record: "Employee",
id: 'EmployeeID',
datatype: "xml",
async: false,
url: url
};
var employeesAdapter = new $.jqx.dataAdapter(source);
var orderdetailsurl = "https://s3.amazonaws.com/caseykelso-smartsheetplugin/jqwidgets/orderdetails.xml";
var ordersSource =
{
datafields: [
{ name: 'EmployeeID', type: 'string' },
{ name: 'ShipName', type: 'string' },
{ name: 'ShipAddress', type: 'string' },
{ name: 'ShipCity', type: 'string' },
{ name: 'ShipCountry', type: 'string' },
{ name: 'ShippedDate', type: 'date' }
],
root: "Orders",
record: "Order",
datatype: "xml",
url: orderdetailsurl,
async: false
};
var ordersDataAdapter = new $.jqx.dataAdapter(ordersSource, { autoBind: true });
orders = ordersDataAdapter.records;
var nestedGrids = new Array();
// create nested grid.
var initrowdetails = function (index, parentElement, gridElement, record) {
var id = record.uid.toString();
var grid = $($(parentElement).children()[0]);
nestedGrids[index] = grid;
var filtergroup = new $.jqx.filter();
var filter_or_operator = 1;
var filtervalue = id;
var filtercondition = 'equal';
var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
// fill the orders depending on the id.
var ordersbyid = [];
for (var m = 0; m < orders.length; m++) {
var result = filter.evaluate(orders[m]["EmployeeID"]);
if (result)
ordersbyid.push(orders[m]);
}
var orderssource = { datafields: [
{ name: 'EmployeeID', type: 'string' },
{ name: 'ShipName', type: 'string' },
{ name: 'ShipAddress', type: 'string' },
{ name: 'ShipCity', type: 'string' },
{ name: 'ShipCountry', type: 'string' },
{ name: 'ShippedDate', type: 'date' }
],
id: 'OrderID',
localdata: ordersbyid
}
var nestedGridAdapter = new $.jqx.dataAdapter(orderssource);
if (grid != null) {
grid.jqxGrid({
source: nestedGridAdapter, width: 780, height: 200,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 200 },
{ text: 'Ship Address', datafield: 'ShipAddress', width: 200 },
{ text: 'Ship City', datafield: 'ShipCity', width: 150 },
{ text: 'Ship Country', datafield: 'ShipCountry', width: 150 },
{ text: 'Shipped Date', datafield: 'ShippedDate', width: 200 }
]
});
}
}
var photorenderer = function (row, column, value) {
var name = $('#jqxgrid').jqxGrid('getrowdata', row).FirstName;
var imgurl = '../../images/' + name.toLowerCase() + '.png';
var img = '<div style="background: white;"><img style="margin:2px; margin-left: 10px;" width="32" height="32" src="' + imgurl + '"></div>';
return img;
}
var renderer = function (row, column, value) {
return '<span style="margin-left: 4px; margin-top: 9px; float: left;">' + value + '</span>';
}
// creage jqxgrid
$("#jqxgrid").jqxGrid(
{
width: 850,
height: 365,
source: source,
rowdetails: true,
rowsheight: 35,
initrowdetails: initrowdetails,
rowdetailstemplate: { rowdetails: "<div id='grid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true },
ready: function () {
$("#jqxgrid").jqxGrid('showrowdetails', 1);
},
columns: [
{ text: 'Photo', width: 50, cellsrenderer: photorenderer },
{ text: 'First Name', datafield: 'FirstName', width: 100, cellsrenderer: renderer },
{ text: 'Last Name', datafield: 'LastName', width: 100, cellsrenderer: renderer },
{ text: 'Title', datafield: 'Title', width: 180, cellsrenderer: renderer },
{ text: 'Address', datafield: 'Address', width: 300, cellsrenderer: renderer },
{ text: 'City', datafield: 'City', width: 170, cellsrenderer: renderer }
]
});
});
</script>
</body>
</html>