37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
function compareFunction(a, b) {
|
|
return a.Priority[0] - b.Priority[0] || a.Req.length - b.Req.length || a.Req - b.Req;
|
|
}
|
|
|
|
function initIndex(url) {
|
|
$.getJSON(url, function (data) {
|
|
for (var i = data.length - 1; i > -1; i--) {
|
|
if (data[i]['Subject - from Requestor'].length > 255)
|
|
data[i]['Subject - from Requestor'] = data[i]['Subject - from Requestor'].substring(0, 255) + '...';
|
|
if (data[i].Submitted !== '')
|
|
continue;
|
|
data.splice(i, 1);
|
|
}
|
|
data.sort(compareFunction);
|
|
$("#HeaderGrid").igGrid({
|
|
autoGenerateColumns: false,
|
|
dataSource: data,
|
|
height: "100%",
|
|
width: "100%",
|
|
columns: [
|
|
{ key: "Req", dataType: "number" },
|
|
{ key: "Submitted", dataType: "date", format: "date" },
|
|
{ key: "Requestor", dataType: "string" },
|
|
{ key: "Assigned To", dataType: "string" },
|
|
{ key: "Second Resource", dataType: "string" },
|
|
{ key: "Subject - from Requestor", dataType: "string", width: "30%" },
|
|
{ key: "Priority", dataType: "string" },
|
|
],
|
|
features: [
|
|
{ name: "Paging", type: "local", recordCountKey: "TotalRows", pageSize: 25, pageSizeUrlKey: "pageSize", "pageIndexUrlKey": "page", showPageSizeDropDown: false },
|
|
{ name: "Selection", mode: "row", multipleSelection: false },
|
|
{ name: "Filtering", type: "local" },
|
|
{ name: "Sorting", type: "local" },
|
|
],
|
|
});
|
|
});
|
|
} |