(function (b) {
b.jgrid = b.jgrid || {};
b.extend(b.jgrid, {
version: "4.6.0",
htmlDecode: function (b) {
return b && (" " === b || " " === b || 1 === b.length && 160 === b.charCodeAt(0)) ? "" : b ? String(b).replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"').replace(/&/g, "&") : b
},
htmlEncode: function (b) {
return b ? String(b).replace(/&/g, "&").replace(/\"/g, """).replace(//g, ">") : b
},
format: function (e) {
var f = b.makeArray(arguments).slice(1);
null == e && (e = "");
return e.replace(/\{(\d+)\}/g,
function (b, d) {
return f[d]
})
},
msie: "Microsoft Internet Explorer" === navigator.appName,
msiever: function () {
var b = -1;
null != /MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent) && (b = parseFloat(RegExp.$1));
return b
},
getCellIndex: function (e) {
e = b(e);
if (e.is("tr")) return -1;
e = (e.is("td") || e.is("th") ? e : e.closest("td,th"))[0];
return b.jgrid.msie ? b.inArray(e, e.parentNode.cells) : e.cellIndex
},
stripHtml: function (b) {
b = String(b);
var f = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
return b ? (b = b.replace(f, "")) && " " !== b && " " !== b ? b.replace(/\"/g, "'") : "" : b
},
stripPref: function (e, f) {
var c = b.type(e);
if ("string" === c || "number" === c) e = String(e),
f = "" !== e ? String(f).replace(String(e), "") : f;
return f
},
parse: function (e) {
"while(1);" === e.substr(0, 9) && (e = e.substr(9));
"/*" === e.substr(0, 2) && (e = e.substr(2, e.length - 4));
e || (e = "{}");
return !0 === b.jgrid.useJSON && "object" === typeof JSON && "function" === typeof JSON.parse ? JSON.parse(e) : eval("(" + e + ")")
},
parseDate: function (e, f, c, d) {
var a = /^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,
l = "string" === typeof f ? f.match(a) : null,
a = function (a, b) {
a = String(a);
for (b = parseInt(b, 10) || 2; a.length < b;) a = "0" + a;
return a
},
g = {
m: 1,
d: 1,
y: 1970,
h: 0,
i: 0,
s: 0,
u: 0
},
h = 0,
k,
n,
h = function (a, b) {
0 === a ? 12 === b && (b = 0) : 12 !== b && (b += 12);
return b
};
void 0 === d && (d = b.jgrid.formatter.date);
void 0 === d.parseRe && (d.parseRe = /[#%\\\/:_;.,\t\s-]/);
d.masks.hasOwnProperty(e) && (e = d.masks[e]);
if (f && null != f) if (isNaN(f - 0) || "u" !== String(e).toLowerCase()) if (f.constructor === Date) h = f;
else if (null !== l) {
if (h = new Date(parseInt(l[1], 10)), l[3]) {
var m = 60 * Number(l[5]) + Number(l[6]),
m = m * ("-" === l[4] ? 1 : -1),
m = m - h.getTimezoneOffset();
h.setTime(Number(Number(h) + 6E4 * m))
}
} else {
m = 0;
"ISO8601Long" === d.srcformat && "Z" === f.charAt(f.length - 1) && (m -= (new Date).getTimezoneOffset());
f = String(f).replace(/\T/g, "#").replace(/\t/, "%").split(d.parseRe);
e = e.replace(/\T/g, "#").replace(/\t/, "%").split(d.parseRe);
k = 0;
for (n = e.length; k < n; k++) "M" === e[k] && (l = b.inArray(f[k], d.monthNames), -1 !== l && 12 > l && (f[k] = l + 1, g.m = f[k])),
"F" === e[k] && (l = b.inArray(f[k], d.monthNames, 12), -1 !== l && 11 < l && (f[k] = l + 1 - 12, g.m = f[k])),
"a" === e[k] && (l = b.inArray(f[k], d.AmPm), -1 !== l && 2 > l && f[k] === d.AmPm[l] && (f[k] = l, g.h = h(f[k], g.h))),
"A" === e[k] && (l = b.inArray(f[k], d.AmPm), -1 !== l && 1 < l && f[k] === d.AmPm[l] && (f[k] = l - 2, g.h = h(f[k], g.h))),
"g" === e[k] && (g.h = parseInt(f[k], 10)),
void 0 !== f[k] && (g[e[k].toLowerCase()] = parseInt(f[k], 10));
g.f && (g.m = g.f);
if (0 === g.m && 0 === g.y && 0 === g.d) return " ";
g.m = parseInt(g.m, 10) - 1;
h = g.y;
70 <= h && 99 >= h ? g.y = 1900 + g.y : 0 <= h && 69 >= h && (g.y = 2E3 + g.y);
h = new Date(g.y, g.m, g.d, g.h, g.i, g.s, g.u);
0 < m && h.setTime(Number(Number(h) + 6E4 * m))
} else h = new Date(1E3 * parseFloat(f));
else h = new Date(g.y, g.m, g.d, g.h, g.i, g.s, g.u);
if (void 0 === c) return h;
d.masks.hasOwnProperty(c) ? c = d.masks[c] : c || (c = "Y-m-d");
e = h.getHours();
f = h.getMinutes();
g = h.getDate();
m = h.getMonth() + 1;
l = h.getTimezoneOffset();
k = h.getSeconds();
n = h.getMilliseconds();
var r = h.getDay(),
p = h.getFullYear(),
q = (r + 6) % 7 + 1,
x = (new Date(p, m - 1, g) - new Date(p, 0, 1)) / 864E5,
G = {
d: a(g),
D: d.dayNames[r],
j: g,
l: d.dayNames[r + 7],
N: q,
S: d.S(g),
w: r,
z: x,
W: 5 > q ? Math.floor((x + q - 1) / 7) + 1 : Math.floor((x + q - 1) / 7) || (4 > ((new Date(p - 1, 0, 1)).getDay() + 6) % 7 ? 53 : 52),
F: d.monthNames[m - 1 + 12],
m: a(m),
M: d.monthNames[m - 1],
n: m,
t: "?",
L: "?",
o: "?",
Y: p,
y: String(p).substring(2),
a: 12 > e ? d.AmPm[0] : d.AmPm[1],
A: 12 > e ? d.AmPm[2] : d.AmPm[3],
B: "?",
g: e % 12 || 12,
G: e,
h: a(e % 12 || 12),
H: a(e),
i: a(f),
s: a(k),
u: n,
e: "?",
I: "?",
O: (0 < l ? "-" : "+") + a(100 * Math.floor(Math.abs(l) / 60) + Math.abs(l) % 60, 4),
P: "?",
T: (String(h).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g) || [""]).pop().replace(/[^-+\dA-Z]/g, ""),
Z: "?",
c: "?",
r: "?",
U: Math.floor(h / 1E3)
};
return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
function (a) {
return G.hasOwnProperty(a) ? G[a] : a.substring(1)
})
},
jqID: function (b) {
return String(b).replace(/[!"#$%&'()*+,.\/:; <=>?@\[\\\]\^`{|}~]/g, "\\$&")
},
guid: 1,
uidPref: "jqg",
randId: function (e) {
return (e || b.jgrid.uidPref) + b.jgrid.guid++
},
getAccessor: function (b, f) {
var c, d, a = [],
l;
if ("function" === typeof f) return f(b);
c = b[f];
if (void 0 === c) try {
if ("string" === typeof f && (a = f.split(".")), l = a.length) for (c = b; c && l--;) d = a.shift(),
c = c[d]
} catch (g) { }
return c
},
getXmlData: function (e, f, c) {
var d = "string" === typeof f ? f.match(/^(.*)\[(\w+)\]$/) : null;
if ("function" === typeof f) return f(e);
if (d && d[2]) return d[1] ? b(d[1], e).attr(d[2]) : b(e).attr(d[2]);
e = b(f, e);
return c ? e : 0 < e.length ? b(e).text() : void 0
},
cellWidth: function () {
var e = b("
"),
f = e.appendTo("body").find("td").width();
e.remove();
return 0.1 < Math.abs(f - 5)
},
cell_width: !0,
ajaxOptions: {},
from: function (e) {
return new
function (e, c) {
"string" === typeof e && (e = b.data(e));
var d = this,
a = e,
l = !0,
g = !1,
h = c,
k = /[\$,%]/g,
n = null,
m = null,
r = 0,
p = !1,
q = "",
x = [],
G = !0;
if ("object" === typeof e && e.push) 0 < e.length && (G = "object" !== typeof e[0] ? !1 : !0);
else throw "data provides is not an array";
this._hasData = function () {
return null === a ? !1 : 0 === a.length ? !1 : !0
};
this._getStr = function (a) {
var b = [];
g && b.push("jQuery.trim(");
b.push("String(" + a + ")");
g && b.push(")");
l || b.push(".toLowerCase()");
return b.join("")
};
this._strComp = function (a) {
return "string" === typeof a ? ".toString()" : ""
};
this._group = function (a, b) {
return {
field: a.toString(),
unique: b,
items: []
}
};
this._toStr = function (a) {
g && (a = b.trim(a));
a = a.toString().replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
return l ? a : a.toLowerCase()
};
this._funcLoop = function (d) {
var l = [];
b.each(a,
function (a, b) {
l.push(d(b))
});
return l
};
this._append = function (a) {
var b;
h = null === h ? "" : h + ("" === q ? " && " : q);
for (b = 0; b < r; b++) h += "(";
p && (h += "!");
h += "(" + a + ")";
p = !1;
q = "";
r = 0
};
this._setCommand = function (a, b) {
n = a;
m = b
};
this._resetNegate = function () {
p = !1
};
this._repeatCommand = function (a, b) {
return null === n ? d : null !== a && null !== b ? n(a, b) : null !== m && G ? n(m, a) : n(a)
};
this._equals = function (a, b) {
return 0 === d._compare(a, b, 1)
};
this._compare = function (a, b, d) {
var e = Object.prototype.toString;
void 0 === d && (d = 1);
void 0 === a && (a = null);
void 0 === b && (b = null);
if (null === a && null === b) return 0;
if (null === a && null !== b) return 1;
if (null !== a && null === b) return -1;
if ("[object Date]" === e.call(a) && "[object Date]" === e.call(b)) return a < b ? -d : a > b ? d : 0;
l || "number" === typeof a || "number" === typeof b || (a = String(a), b = String(b));
return a < b ? -d : a > b ? d : 0
};
this._performSort = function () {
0 !== x.length && (a = d._doSort(a, 0))
};
this._doSort = function (a, b) {
var l = x[b].by,
e = x[b].dir,
g = x[b].type,
c = x[b].datefmt,
f = x[b].sfunc;
if (b === x.length - 1) return d._getOrder(a, l, e, g, c, f);
b++;
l = d._getGroup(a, l, e, g, c);
e = [];
for (g = 0; g < l.length; g++) for (f = d._doSort(l[g].items, b), c = 0; c < f.length; c++) e.push(f[c]);
return e
};
this._getOrder = function (a, e, g, c, f, h) {
var m = [],
n = [],
r = "a" === g ? 1 : -1,
p,
x;
void 0 === c && (c = "text");
x = "float" === c || "number" === c || "currency" === c || "numeric" === c ?
function (a) {
a = parseFloat(String(a).replace(k, ""));
return isNaN(a) ? 0 : a
} : "int" === c || "integer" === c ?
function (a) {
return a ? parseFloat(String(a).replace(k, "")) : 0
} : "date" === c || "datetime" === c ?
function (a) {
return b.jgrid.parseDate(f, a).getTime()
} : b.isFunction(c) ? c : function (a) {
a = a ? b.trim(String(a)) : "";
return l ? a : a.toLowerCase()
};
b.each(a,
function (a, d) {
p = "" !== e ? b.jgrid.getAccessor(d, e) : d;
void 0 === p && (p = "");
p = x(p, d);
n.push({
vSort: p,
index: a
})
});
b.isFunction(h) ? n.sort(function (a, b) {
a = a.vSort;
b = b.vSort;
return h.call(this, a, b, r)
}) : n.sort(function (a, b) {
a = a.vSort;
b = b.vSort;
return d._compare(a, b, r)
});
c = 0;
for (var q = a.length; c < q;) g = n[c].index,
m.push(a[g]),
c++;
return m
};
this._getGroup = function (a, c, e, l, g) {
var f = [],
h = null,
k = null,
m;
b.each(d._getOrder(a, c, e, l, g),
function (a, e) {
m = b.jgrid.getAccessor(e, c);
null == m && (m = "");
d._equals(k, m) || (k = m, null !== h && f.push(h), h = d._group(c, m));
h.items.push(e)
});
null !== h && f.push(h);
return f
};
this.ignoreCase = function () {
l = !1;
return d
};
this.useCase = function () {
l = !0;
return d
};
this.trim = function () {
g = !0;
return d
};
this.noTrim = function () {
g = !1;
return d
};
this.execute = function () {
var c = h,
e = [];
if (null === c) return d;
b.each(a,
function () {
eval(c) && e.push(this)
});
a = e;
return d
};
this.data = function () {
return a
};
this.select = function (c) {
d._performSort();
if (!d._hasData()) return [];
d.execute();
if (b.isFunction(c)) {
var e = [];
b.each(a,
function (a, b) {
e.push(c(b))
});
return e
}
return a
};
this.hasMatch = function () {
if (!d._hasData()) return !1;
d.execute();
return 0 < a.length
};
this.andNot = function (a, b, c) {
p = !p;
return d.and(a, b, c)
};
this.orNot = function (a, b, c) {
p = !p;
return d.or(a, b, c)
};
this.not = function (a, b, c) {
return d.andNot(a, b, c)
};
this.and = function (a, b, c) {
q = " && ";
return void 0 === a ? d : d._repeatCommand(a, b, c)
};
this.or = function (a, b, c) {
q = " || ";
return void 0 === a ? d : d._repeatCommand(a, b, c)
};
this.orBegin = function () {
r++;
return d
};
this.orEnd = function () {
null !== h && (h += ")");
return d
};
this.isNot = function (a) {
p = !p;
return d.is(a)
};
this.is = function (a) {
d._append("this." + a);
d._resetNegate();
return d
};
this._compareValues = function (a, c, e, l, g) {
var f;
f = G ? "jQuery.jgrid.getAccessor(this,'" + c + "')" : "this";
void 0 === e && (e = null);
var h = e,
m = void 0 === g.stype ? "text" : g.stype;
if (null !== e) switch (m) {
case "int":
case "integer":
h = isNaN(Number(h)) || "" === h ? "0" : h;
f = "parseInt(" + f + ",10)";
h = "parseInt(" + h + ",10)";
break;
case "float":
case "number":
case "numeric":
h = String(h).replace(k, "");
h = isNaN(Number(h)) || "" === h ? "0" : h;
f = "parseFloat(" + f + ")";
h = "parseFloat(" + h + ")";
break;
case "date":
case "datetime":
h = String(b.jgrid.parseDate(g.newfmt || "Y-m-d", h).getTime());
f = 'jQuery.jgrid.parseDate("' + g.srcfmt + '",' + f + ").getTime()";
break;
default:
f = d._getStr(f),
h = d._getStr('"' + d._toStr(h) + '"')
}
d._append(f + " " + l + " " + h);
d._setCommand(a, c);
d._resetNegate();
return d
};
this.equals = function (a, b, c) {
return d._compareValues(d.equals, a, b, "==", c)
};
this.notEquals = function (a, b, c) {
return d._compareValues(d.equals, a, b, "!==", c)
};
this.isNull = function (a, b, c) {
return d._compareValues(d.equals, a, null, "===", c)
};
this.greater = function (a, b, c) {
return d._compareValues(d.greater, a, b, ">", c)
};
this.less = function (a, b, c) {
return d._compareValues(d.less, a, b, "<", c)
};
this.greaterOrEquals = function (a, b, c) {
return d._compareValues(d.greaterOrEquals, a, b, ">=", c)
};
this.lessOrEquals = function (a, b, c) {
return d._compareValues(d.lessOrEquals, a, b, "<=", c)
};
this.startsWith = function (a, c) {
var e = null == c ? a : c,
e = g ? b.trim(e.toString()).length : e.toString().length;
G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".substr(0," + e + ") == " + d._getStr('"' + d._toStr(c) + '"')) : (null != c && (e = g ? b.trim(c.toString()).length : c.toString().length), d._append(d._getStr("this") + ".substr(0," + e + ") == " + d._getStr('"' + d._toStr(a) + '"')));
d._setCommand(d.startsWith, a);
d._resetNegate();
return d
};
this.endsWith = function (a, c) {
var e = null == c ? a : c,
e = g ? b.trim(e.toString()).length : e.toString().length;
G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".substr(" + d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".length-" + e + "," + e + ') == "' + d._toStr(c) + '"') : d._append(d._getStr("this") + ".substr(" + d._getStr("this") + '.length-"' + d._toStr(a) + '".length,"' + d._toStr(a) + '".length) == "' + d._toStr(a) + '"');
d._setCommand(d.endsWith, a);
d._resetNegate();
return d
};
this.contains = function (a, b) {
G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + '.indexOf("' + d._toStr(b) + '",0) > -1') : d._append(d._getStr("this") + '.indexOf("' + d._toStr(a) + '",0) > -1');
d._setCommand(d.contains, a);
d._resetNegate();
return d
};
this.groupBy = function (b, c, e, l) {
return d._hasData() ? d._getGroup(a, b, c, e, l) : null
};
this.orderBy = function (a, c, e, l, g) {
c = null == c ? "a" : b.trim(c.toString().toLowerCase());
null == e && (e = "text");
null == l && (l = "Y-m-d");
null == g && (g = !1);
if ("desc" === c || "descending" === c) c = "d";
if ("asc" === c || "ascending" === c) c = "a";
x.push({
by: a,
dir: c,
type: e,
datefmt: l,
sfunc: g
});
return d
};
return d
}(e, null)
},
getMethod: function (e) {
return this.getAccessor(b.fn.jqGrid, e)
},
extend: function (e) {
b.extend(b.fn.jqGrid, e);
this.no_legacy_api || b.fn.extend(e)
}
});
b.fn.jqGrid = function (e) {
if ("string" === typeof e) {
var f = b.jgrid.getMethod(e);
if (!f) throw "jqGrid - No such method: " + e;
var c = b.makeArray(arguments).slice(1);
return f.apply(this, c)
}
return this.each(function () {
if (!this.grid) {
var d = b.extend(!0, {
unwritten: true,
costtime: '000.1',
url: "",
height: 150,
page: 1,
rowNum: 20,
rowTotal: null,
records: 0,
pager: "",
pgbuttons: !0,
pginput: !0,
colModel: [],
rowList: [],
colNames: [],
sortorder: "asc",
sortname: "",
datatype: "xml",
mtype: "GET",
altRows: !1,
selarrrow: [],
savedRow: [],
shrinkToFit: !0,
xmlReader: {},
jsonReader: {},
subGrid: !1,
subGridModel: [],
reccount: 0,
lastpage: 0,
lastsort: 0,
selrow: null,
beforeSelectRow: null,
onSelectRow: null,
onSortCol: null,
ondblClickRow: null,
onRightClickRow: null,
onPaging: null,
onSelectAll: null,
onInitGrid: null,
loadComplete: null,
gridComplete: null,
loadError: null,
loadBeforeSend: null,
afterInsertRow: null,
beforeRequest: null,
beforeProcessing: null,
onHeaderClick: null,
viewrecords: !1,
loadonce: !1,
multiselect: !1,
multikey: !1,
editurl: null,
search: !1,
caption: "",
hidegrid: !0,
hiddengrid: !1,
postData: {},
userData: {},
treeGrid: !1,
treeGridModel: "nested",
treeReader: {},
treeANode: -1,
ExpandColumn: null,
tree_root_level: 0,
prmNames: {
page: "page",
rows: "rows",
sort: "sidx",
order: "sord",
search: "_search",
nd: "nd",
id: "id",
oper: "oper",
editoper: "edit",
addoper: "add",
deloper: "del",
subgridid: "id",
npage: null,
totalrows: "totalrows"
},
forceFit: !1,
gridstate: "visible",
cellEdit: !1,
cellsubmit: "remote",
nv: 0,
loadui: "enable",
toolbar: [!1, ""],
scroll: !1,
multiboxonly: !1,
deselectAfterSort: !0,
scrollrows: !1,
autowidth: !1,
scrollOffset: 18,
cellLayout: 5,
subGridWidth: 20,
multiselectWidth: 20,
gridview: !1,
rownumWidth: 30,
rownumbers: !1,
pagerpos: "center",
recordpos: "right",
footerrow: !1,
userDataOnFooter: !1,
hoverrows: !0,
altclass: "ui-priority-secondary",
viewsortcols: [!1, "vertical", !0],
resizeclass: "",
autoencode: !1,
remapColumns: [],
ajaxGridOptions: {},
direction: "ltr",
toppager: !1,
headertitles: !1,
scrollTimeout: 40,
data: [],
_index: {},
grouping: !1,
groupingView: {
groupField: [],
groupOrder: [],
groupText: [],
groupColumnShow: [],
groupSummary: [],
showSummaryOnHide: !1,
sortitems: [],
sortnames: [],
summary: [],
summaryval: [],
plusicon: "ui-icon-circlesmall-plus",
minusicon: "ui-icon-circlesmall-minus",
displayField: [],
groupSummaryPos: [],
formatDisplayField: [],
_locgr: !1
},
ignoreCase: !1,
cmTemplate: {},
idPrefix: "",
multiSort: !1
},
b.jgrid.defaults, e || {}),
a = this,
c = {
headers: [],
cols: [],
footers: [],
dragStart: function (c, e, g) {
var f = b(this.bDiv).offset().left;
this.resizing = {
idx: c,
startX: e.clientX,
sOL: e.clientX - f
};
this.hDiv.style.cursor = "col-resize";
this.curGbox = b("#rs_m" + b.jgrid.jqID(d.id), "#gbox_" + b.jgrid.jqID(d.id));
this.curGbox.css({
display: "block",
left: e.clientX - f,
top: g[1],
height: g[2]
});
b(a).triggerHandler("jqGridResizeStart", [e, c]);
b.isFunction(d.resizeStart) && d.resizeStart.call(a, e, c);
document.onselectstart = function () {
return !1
}
},
dragMove: function (a) {
if (this.resizing) {
var b = a.clientX - this.resizing.startX;
a = this.headers[this.resizing.idx];
var c = "ltr" === d.direction ? a.width + b : a.width - b,
e;
33 < c && (this.curGbox.css({
left: this.resizing.sOL + b
}), !0 === d.forceFit ? (e = this.headers[this.resizing.idx + d.nv], b = "ltr" === d.direction ? e.width - b : e.width + b, 33 < b && (a.newWidth = c, e.newWidth = b)) : (this.newWidth = "ltr" === d.direction ? d.tblwidth + b : d.tblwidth - b, a.newWidth = c))
}
},
dragEnd: function () {
this.hDiv.style.cursor = "default";
if (this.resizing) {
var c = this.resizing.idx,
e = this.headers[c].newWidth || this.headers[c].width,
e = parseInt(e, 10);
this.resizing = !1;
b("#rs_m" + b.jgrid.jqID(d.id)).css("display", "none");
d.colModel[c].width = e;
this.headers[c].width = e;
this.headers[c].el.style.width = e + "px";
this.cols[c].style.width = e + "px";
0 < this.footers.length && (this.footers[c].style.width = e + "px"); !0 === d.forceFit ? (e = this.headers[c + d.nv].newWidth || this.headers[c + d.nv].width, this.headers[c + d.nv].width = e, this.headers[c + d.nv].el.style.width = e + "px", this.cols[c + d.nv].style.width = e + "px", 0 < this.footers.length && (this.footers[c + d.nv].style.width = e + "px"), d.colModel[c + d.nv].width = e) : (d.tblwidth = this.newWidth || d.tblwidth, b("table:first", this.bDiv).css("width", d.tblwidth + "px"), b("table:first", this.hDiv).css("width", d.tblwidth + "px"), this.hDiv.scrollLeft = this.bDiv.scrollLeft, d.footerrow && (b("table:first", this.sDiv).css("width", d.tblwidth + "px"), this.sDiv.scrollLeft = this.bDiv.scrollLeft));
b(a).triggerHandler("jqGridResizeStop", [e, c]);
b.isFunction(d.resizeStop) && d.resizeStop.call(a, e, c)
}
this.curGbox = null;
document.onselectstart = function () {
return !0
}
},
populateVisible: function () {
c.timer && clearTimeout(c.timer);
c.timer = null;
var a = b(c.bDiv).height();
if (a) {
var e = b("table:first", c.bDiv),
g,
f;
if (e[0].rows.length) try {
f = (g = e[0].rows[1]) ? b(g).outerHeight() || c.prevRowHeight : c.prevRowHeight
} catch (pa) {
f = c.prevRowHeight
}
if (f) {
c.prevRowHeight = f;
var h = d.rowNum;
g = c.scrollTop = c.bDiv.scrollTop;
var k = Math.round(e.position().top) - g,
m = k + e.height();
f *= h;
var E, n, C;
m < a && 0 >= k && (void 0 === d.lastpage || parseInt((m + g + f - 1) / f, 10) <= d.lastpage) && (n = parseInt((a - m + f - 1) / f, 10), 0 <= m || 2 > n || !0 === d.scroll ? (E = Math.round((m + g) / f) + 1, k = -1) : k = 1);
0 < k && (E = parseInt(g / f, 10) + 1, n = parseInt((g + a) / f, 10) + 2 - E, C = !0); !n || d.lastpage && (E > d.lastpage || 1 === d.lastpage || E === d.page && E === d.lastpage) || (c.hDiv.loading ? c.timer = setTimeout(c.populateVisible, d.scrollTimeout) : (d.page = E, C && (c.selectionPreserver(e[0]), c.emptyRows.call(e[0], !1, !1)), c.populate(n)))
}
}
},
scrollGrid: function (a) {
if (d.scroll) {
var b = c.bDiv.scrollTop;
void 0 === c.scrollTop && (c.scrollTop = 0);
b !== c.scrollTop && (c.scrollTop = b, c.timer && clearTimeout(c.timer), c.timer = setTimeout(c.populateVisible, d.scrollTimeout))
}
c.hDiv.scrollLeft = c.bDiv.scrollLeft;
d.footerrow && (c.sDiv.scrollLeft = c.bDiv.scrollLeft);
a && a.stopPropagation()
},
selectionPreserver: function (a) {
var c = a.p,
d = c.selrow,
e = c.selarrrow ? b.makeArray(c.selarrrow) : null,
f = a.grid.bDiv.scrollLeft,
g = function () {
var h;
c.selrow = null;
c.selarrrow = [];
if (c.multiselect && e && 0 < e.length) for (h = 0; h < e.length; h++) e[h] !== d && b(a).jqGrid("setSelection", e[h], !1, null);
d && b(a).jqGrid("setSelection", d, !1, null);
a.grid.bDiv.scrollLeft = f;
b(a).unbind(".selectionPreserver", g)
};
b(a).bind("jqGridGridComplete.selectionPreserver", g)
}
};
if ("TABLE" !== this.tagName.toUpperCase()) alert("Element is not a table");
else if (void 0 !== document.documentMode && 5 >= document.documentMode) alert("Grid can not be used in this ('quirks') mode!");
else {
b(this).empty().attr("tabindex", "0");
this.p = d;
this.p.useProp = !!b.fn.prop;
var g, f;
if (0 === this.p.colNames.length) for (g = 0; g < this.p.colModel.length; g++) this.p.colNames[g] = this.p.colModel[g].label || this.p.colModel[g].name;
if (this.p.colNames.length !== this.p.colModel.length) alert(b.jgrid.errors.model);
else {
var k = b(""),
n = b.jgrid.msie;
a.p.direction = b.trim(a.p.direction.toLowerCase()); -1 === b.inArray(a.p.direction, ["ltr", "rtl"]) && (a.p.direction = "ltr");
f = a.p.direction;
b(k).insertBefore(this);
b(this).removeClass("scroll").appendTo(k);
var m = b("");
b(m).attr({
id: "gbox_" + this.id,
dir: f
}).insertBefore(k);
b(k).attr("id", "gview_" + this.id).appendTo(m);
b("").insertBefore(k);
b("
" + this.p.loadtext + "
").insertBefore(k);
b(this).attr({
cellspacing: "0",
cellpadding: "0",
border: "0",
role: "grid",
"aria-multiselectable": !!this.p.multiselect,
"aria-labelledby": "gbox_" + this.id
});
var r = function (a, b) {
a = parseInt(a, 10);
return isNaN(a) ? b || 0 : a
},
p = function (d, e, f, g, i, h) {
var k = a.p.colModel[d],
m = k.align,
E = 'style="',
n = k.classes,
C = k.name,
A = [];
m && (E += "text-align:" + m + ";"); !0 === k.hidden && (E += "display:none;");
if (0 === e) E += "width: " + c.headers[d].width + "px;";
else if (k.cellattr && b.isFunction(k.cellattr) && (d = k.cellattr.call(a, i, f, g, k, h)) && "string" === typeof d) if (d = d.replace(/style/i, "style").replace(/title/i, "title"), -1 < d.indexOf("title") && (k.title = !1), -1 < d.indexOf("class") && (n = void 0), A = d.replace("-style", "-sti").split(/style/), 2 === A.length) {
A[1] = b.trim(A[1].replace("-sti", "-style").replace("=", ""));
if (0 === A[1].indexOf("'") || 0 === A[1].indexOf('"')) A[1] = A[1].substring(1);
E += A[1].replace(/'/gi, '"')
} else E += '"';
A.length || (A[0] = "", E += '"');
E += (void 0 !== n ? ' class="' + n + '"' : "") + (k.title && f ? ' title="' + b.jgrid.stripHtml(f) + '"' : "");
E += ' aria-describedby="' + a.p.id + "_" + C + '"';
return E + A[0]
},
q = function (c) {
return null == c || "" === c ? " " : a.p.autoencode ? b.jgrid.htmlEncode(c) : String(c)
},
x = function (c, d, e, f, g) {
var h = a.p.colModel[e];
void 0 !== h.formatter ? (c = "" !== String(a.p.idPrefix) ? b.jgrid.stripPref(a.p.idPrefix, c) : c, c = {
rowId: c,
colModel: h,
gid: a.p.id,
pos: e
},
d = b.isFunction(h.formatter) ? h.formatter.call(a, d, c, f, g) : b.fmatter ? b.fn.fmatter.call(a, h.formatter, d, c, f, g) : q(d)) : d = q(d);
return d
},
G = function (a, b, c, d, e, f) {
b = x(a, b, c, e, "add");
return '
" + b + "
"
},
U = function (b, c, d, e) {
e = '";
return '
" + e + "
"
},
M = function (a, b, c, d) {
c = (parseInt(c, 10) - 1) * parseInt(d, 10) + 1 + b;
return '
" + c + "
"
},
ea = function (b) {
var c, d = [],
e = 0,
f;
for (f = 0; f < a.p.colModel.length; f++) c = a.p.colModel[f],
"cb" !== c.name && "subgrid" !== c.name && "rn" !== c.name && (d[e] = "local" === b ? c.name : "xml" === b || "xmlstring" === b ? c.xmlmap || c.name : c.jsonmap || c.name, !1 !== a.p.keyIndex && !0 === c.key && (a.p.keyName = d[e]), e++);
return d
},
W = function (c) {
var d = a.p.remapColumns;
d && d.length || (d = b.map(a.p.colModel,
function (a, b) {
return b
}));
c && (d = b.map(d,
function (a) {
return a < c ? null : a - c
}));
return d
},
X = function (a, c) {
var d;
this.p.deepempty ? b(this.rows).slice(1).remove() : (d = 0 < this.rows.length ? this.rows[0] : null, b(this.firstChild).empty().append(d));
a && this.p.scroll && (b(this.grid.bDiv.firstChild).css({
height: "auto"
}), b(this.grid.bDiv.firstChild.firstChild).css({
height: 0,
display: "none"
}), 0 !== this.grid.bDiv.scrollTop && (this.grid.bDiv.scrollTop = 0)); !0 === c && this.p.treeGrid && (this.p.data = [], this.p._index = {})
},
O = function () {
var c = a.p.data.length,
d, e, f;
d = !0 === a.p.rownumbers ? 1 : 0;
e = !0 === a.p.multiselect ? 1 : 0;
f = !0 === a.p.subGrid ? 1 : 0;
d = !1 === a.p.keyIndex || !0 === a.p.loadonce ? a.p.localReader.id : a.p.colModel[a.p.keyIndex + e + f + d].name;
for (e = 0; e < c; e++) f = b.jgrid.getAccessor(a.p.data[e], d),
void 0 === f && (f = String(e + 1)),
a.p._index[f] = e
},
$ = function (c, d, e, f, g, h) {
var l = "-1",
k = "",
m;
d = d ? "display:none;" : "";
e = "ui-widget-content jqgrow ui-row-" + a.p.direction + (e ? " " + e : "") + (h ? " ui-state-highlight" : "");
h = b(a).triggerHandler("jqGridRowAttr", [f, g, c]);
"object" !== typeof h && (h = b.isFunction(a.p.rowattr) ? a.p.rowattr.call(a, f, g, c) : {});
if (!b.isEmptyObject(h)) {
h.hasOwnProperty("id") && (c = h.id, delete h.id);
h.hasOwnProperty("tabindex") && (l = h.tabindex, delete h.tabindex);
h.hasOwnProperty("style") && (d += h.style, delete h.style);
h.hasOwnProperty("class") && (e += " " + h["class"], delete h["class"]);
try {
delete h.role
} catch (n) { }
for (m in h) h.hasOwnProperty(m) && (k += " " + m + "=" + h[m])
}
return '
"
},
K = function (c, d, e, f, g) {
var h = new Date,
l = "local" !== a.p.datatype && a.p.loadonce || "xmlstring" === a.p.datatype,
k = a.p.xmlReader,
m = "local" === a.p.datatype ? "local" : "xml";
l && (a.p.data = [], a.p._index = {},
a.p.localReader.id = "_id_");
a.p.reccount = 0;
if (b.isXMLDoc(c)) {
-1 !== a.p.treeANode || a.p.scroll ? e = 1 < e ? e : 1 : (X.call(a, !1, !0), e = 1);
var n = b(a),
C,
A,
R = 0,
p,
u = !0 === a.p.multiselect ? 1 : 0,
z = 0,
x,
q = !0 === a.p.rownumbers ? 1 : 0,
t,
Z = [],
aa,
v = {},
w,
H,
s = [],
L = !0 === a.p.altRows ? a.p.altclass : "",
ia; !0 === a.p.subGrid && (z = 1, x = b.jgrid.getMethod("addSubGridCell"));
k.repeatitems || (Z = ea(m));
t = !1 === a.p.keyIndex ? b.isFunction(k.id) ? k.id.call(a, c) : k.id : a.p.keyIndex;
0 < Z.length && !isNaN(t) && (t = a.p.keyName);
m = -1 === String(t).indexOf("[") ? Z.length ?
function (a, c) {
return b(t, a).text() || c
} : function (a, c) {
return b(k.cell, a).eq(t).text() || c
} : function (a, b) {
return a.getAttribute(t.replace(/[\[\]]/g, "")) || b
};
a.p.userData = {};
a.p.page = r(b.jgrid.getXmlData(c, k.page), a.p.page);
a.p.lastpage = r(b.jgrid.getXmlData(c, k.total), 1);
a.p.records = r(b.jgrid.getXmlData(c, k.records));
b.isFunction(k.userdata) ? a.p.userData = k.userdata.call(a, c) || {} : b.jgrid.getXmlData(c, k.userdata, !0).each(function () {
a.p.userData[this.getAttribute("name")] = b(this).text()
});
c = b.jgrid.getXmlData(c, k.root, !0); (c = b.jgrid.getXmlData(c, k.row, !0)) || (c = []);
var S = c.length,
I = 0,
y = [],
D = parseInt(a.p.rowNum, 10),
B = a.p.scroll ? b.jgrid.randId() : 1;
0 < S && 0 >= a.p.page && (a.p.page = 1);
if (c && S) {
g && (D *= g + 1);
g = b.isFunction(a.p.afterInsertRow);
var F = !1,
J;
a.p.grouping && (F = !0 === a.p.groupingView.groupCollapse, J = b.jgrid.getMethod("groupingPrepare"));
for (; I < S;) {
w = c[I];
H = m(w, B + I);
H = a.p.idPrefix + H;
C = 0 === e ? 0 : e + 1;
ia = 1 === (C + I) % 2 ? L : "";
var K = s.length;
s.push("");
q && s.push(M(0, I, a.p.page, a.p.rowNum));
u && s.push(U(H, q, I, !1));
z && s.push(x.call(n, u + q, I + e));
if (k.repeatitems) {
aa || (aa = W(u + z + q));
var N = b.jgrid.getXmlData(w, k.cell, !0);
b.each(aa,
function (b) {
var c = N[this];
if (!c) return !1;
p = c.textContent || c.text;
v[a.p.colModel[b + u + z + q].name] = p;
s.push(G(H, p, b + u + z + q, I + e, w, v))
})
} else for (C = 0; C < Z.length; C++) p = b.jgrid.getXmlData(w, Z[C]),
v[a.p.colModel[C + u + z + q].name] = p,
s.push(G(H, p, C + u + z + q, I + e, w, v));
s[K] = $(H, F, ia, v, w, !1);
s.push("
");
a.p.grouping && (y.push(s), a.p.groupingView._locgr || J.call(n, v, I), s = []);
if (l || !0 === a.p.treeGrid) v._id_ = b.jgrid.stripPref(a.p.idPrefix, H),
a.p.data.push(v),
a.p._index[v._id_] = a.p.data.length - 1; !1 === a.p.gridview && (b("tbody:first", d).append(s.join("")), n.triggerHandler("jqGridAfterInsertRow", [H, v, w]), g && a.p.afterInsertRow.call(a, H, v, w), s = []);
v = {};
R++;
I++;
if (R === D) break
}
} !0 === a.p.gridview && (A = -1 < a.p.treeANode ? a.p.treeANode : 0, a.p.grouping ? (l || n.jqGrid("groupingRender", y, a.p.colModel.length, a.p.page, D), y = null) : !0 === a.p.treeGrid && 0 < A ? b(a.rows[A]).after(s.join("")) : b("tbody:first", d).append(s.join("")));
if (!0 === a.p.subGrid) try {
n.jqGrid("addSubGrid", u + q)
} catch (Q) { }
a.p.totaltime = new Date - h;
0 < R && 0 === a.p.records && (a.p.records = S);
s = null;
if (!0 === a.p.treeGrid) try {
n.jqGrid("setTreeNode", A + 1, R + A + 1)
} catch (O) { }
a.p.treeGrid || a.p.scroll || (a.grid.bDiv.scrollTop = 0);
a.p.reccount = R;
a.p.treeANode = -1;
a.p.userDataOnFooter && n.jqGrid("footerData", "set", a.p.userData, !0);
l && (a.p.records = S, a.p.lastpage = Math.ceil(S / D));
f || a.updatepager(!1, !0);
if (l) {
for (; R < S;) {
w = c[R];
H = m(w, R + B);
H = a.p.idPrefix + H;
if (k.repeatitems) {
aa || (aa = W(u + z + q));
var P = b.jgrid.getXmlData(w, k.cell, !0);
b.each(aa,
function (b) {
var c = P[this];
if (!c) return !1;
p = c.textContent || c.text;
v[a.p.colModel[b + u + z + q].name] = p
})
} else for (C = 0; C < Z.length; C++) p = b.jgrid.getXmlData(w, Z[C]),
v[a.p.colModel[C + u + z + q].name] = p;
v._id_ = b.jgrid.stripPref(a.p.idPrefix, H);
a.p.grouping && J.call(n, v, R);
a.p.data.push(v);
a.p._index[v._id_] = a.p.data.length - 1;
v = {};
R++
}
a.p.grouping && (a.p.groupingView._locgr = !0, n.jqGrid("groupingRender", y, a.p.colModel.length, a.p.page, D), y = null)
}
}
},
Y = function (c, d, e, f, g) {
var h = new Date;
if (c) {
-1 !== a.p.treeANode || a.p.scroll ? e = 1 < e ? e : 1 : (X.call(a, !1, !0), e = 1);
var k, l = "local" !== a.p.datatype && a.p.loadonce || "jsonstring" === a.p.datatype;
l && (a.p.data = [], a.p._index = {},
a.p.localReader.id = "_id_");
a.p.reccount = 0;
"local" === a.p.datatype ? (d = a.p.localReader, k = "local") : (d = a.p.jsonReader, k = "json");
var m = b(a),
n = 0,
C,
A,
p,
q = [],
u = a.p.multiselect ? 1 : 0,
z = !0 === a.p.subGrid ? 1 : 0,
x,
t = !0 === a.p.rownumbers ? 1 : 0,
D = W(u + z + t);
k = ea(k);
var y, B, v, w = {},
H, s, L = [],
ia = !0 === a.p.altRows ? a.p.altclass : "",
S;
a.p.page = r(b.jgrid.getAccessor(c, d.page), a.p.page);
a.p.lastpage = r(b.jgrid.getAccessor(c, d.total), 1);
a.p.records = r(b.jgrid.getAccessor(c, d.records));
a.p.userData = b.jgrid.getAccessor(c, d.userdata) || {};
z && (x = b.jgrid.getMethod("addSubGridCell"));
v = !1 === a.p.keyIndex ? b.isFunction(d.id) ? d.id.call(a, c) : d.id : a.p.keyIndex;
d.repeatitems || (q = k, 0 < q.length && !isNaN(v) && (v = a.p.keyName));
B = b.jgrid.getAccessor(c, d.root);
null == B && b.isArray(c) && (B = c);
B || (B = []);
c = B.length;
A = 0;
0 < c && 0 >= a.p.page && (a.p.page = 1);
var I = parseInt(a.p.rowNum, 10),
F = a.p.scroll ? b.jgrid.randId() : 1,
J = !1,
K;
g && (I *= g + 1);
"local" !== a.p.datatype || a.p.deselectAfterSort || (J = !0);
var N = b.isFunction(a.p.afterInsertRow),
P = [],
Q = !1,
O;
a.p.grouping && (Q = !0 === a.p.groupingView.groupCollapse, O = b.jgrid.getMethod("groupingPrepare"));
for (; A < c;) {
g = B[A];
s = b.jgrid.getAccessor(g, v);
void 0 === s && ("number" === typeof v && null != a.p.colModel[v + u + z + t] && (s = b.jgrid.getAccessor(g, a.p.colModel[v + u + z + t].name)), void 0 === s && (s = F + A, 0 === q.length && d.cell && (C = b.jgrid.getAccessor(g, d.cell) || g, s = null != C && void 0 !== C[v] ? C[v] : s)));
s = a.p.idPrefix + s;
C = 1 === e ? 0 : e;
S = 1 === (C + A) % 2 ? ia : "";
J && (K = a.p.multiselect ? -1 !== b.inArray(s, a.p.selarrrow) : s === a.p.selrow);
var T = L.length;
L.push("");
t && L.push(M(0, A, a.p.page, a.p.rowNum));
u && L.push(U(s, t, A, K));
z && L.push(x.call(m, u + t, A + e));
y = k;
d.repeatitems && (d.cell && (g = b.jgrid.getAccessor(g, d.cell) || g), b.isArray(g) && (y = D));
for (p = 0; p < y.length; p++) C = b.jgrid.getAccessor(g, y[p]),
w[a.p.colModel[p + u + z + t].name] = C,
L.push(G(s, C, p + u + z + t, A + e, g, w));
L[T] = $(s, Q, S, w, g, K);
L.push("");
a.p.grouping && (P.push(L), a.p.groupingView._locgr || O.call(m, w, A), L = []);
if (l || !0 === a.p.treeGrid) w._id_ = b.jgrid.stripPref(a.p.idPrefix, s),
a.p.data.push(w),
a.p._index[w._id_] = a.p.data.length - 1; !1 === a.p.gridview && (b("#" + b.jgrid.jqID(a.p.id) + " tbody:first").append(L.join("")), m.triggerHandler("jqGridAfterInsertRow", [s, w, g]), N && a.p.afterInsertRow.call(a, s, w, g), L = []);
w = {};
n++;
A++;
if (n === I) break
} !0 === a.p.gridview && (H = -1 < a.p.treeANode ? a.p.treeANode : 0, a.p.grouping ? l || (m.jqGrid("groupingRender", P, a.p.colModel.length, a.p.page, I), P = null) : !0 === a.p.treeGrid && 0 < H ? b(a.rows[H]).after(L.join("")) : b("#" + b.jgrid.jqID(a.p.id) + " tbody:first").append(L.join("")));
if (!0 === a.p.subGrid) try {
m.jqGrid("addSubGrid", u + t)
} catch (V) { }
a.p.totaltime = new Date - h;
0 < n && 0 === a.p.records && (a.p.records = c);
if (!0 === a.p.treeGrid) try {
m.jqGrid("setTreeNode", H + 1, n + H + 1)
} catch (Y) { }
a.p.treeGrid || a.p.scroll || (a.grid.bDiv.scrollTop = 0);
a.p.reccount = n;
a.p.treeANode = -1;
a.p.userDataOnFooter && m.jqGrid("footerData", "set", a.p.userData, !0);
l && (a.p.records = c, a.p.lastpage = Math.ceil(c / I));
f || a.updatepager(!1, !0);
if (l) {
for (; n < c && B[n];) {
g = B[n];
s = b.jgrid.getAccessor(g, v);
void 0 === s && ("number" === typeof v && null != a.p.colModel[v + u + z + t] && (s = b.jgrid.getAccessor(g, a.p.colModel[v + u + z + t].name)), void 0 === s && (s = F + n, 0 === q.length && d.cell && (e = b.jgrid.getAccessor(g, d.cell) || g, s = null != e && void 0 !== e[v] ? e[v] : s)));
if (g) {
s = a.p.idPrefix + s;
y = k;
d.repeatitems && (d.cell && (g = b.jgrid.getAccessor(g, d.cell) || g), b.isArray(g) && (y = D));
for (p = 0; p < y.length; p++) w[a.p.colModel[p + u + z + t].name] = b.jgrid.getAccessor(g, y[p]);
w._id_ = b.jgrid.stripPref(a.p.idPrefix, s);
a.p.grouping && O.call(m, w, n);
a.p.data.push(w);
a.p._index[w._id_] = a.p.data.length - 1;
w = {}
}
n++
}
a.p.grouping && (a.p.groupingView._locgr = !0, m.jqGrid("groupingRender", P, a.p.colModel.length, a.p.page, I))
}
}
},
oa = function () {
function c(a) {
var b = 0,
d, e, g, h, k;
if (null != a.groups) {
(e = a.groups.length && "OR" === a.groupOp.toString().toUpperCase()) && u.orBegin();
for (d = 0; d < a.groups.length; d++) {
0 < b && e && u.or();
try {
c(a.groups[d])
} catch (l) {
alert(l)
}
b++
}
e && u.orEnd()
}
if (null != a.rules) try {
(g = a.rules.length && "OR" === a.groupOp.toString().toUpperCase()) && u.orBegin();
for (d = 0; d < a.rules.length; d++) k = a.rules[d],
h = a.groupOp.toString().toUpperCase(),
q[k.op] && k.field && (0 < b && h && "OR" === h && (u = u.or()), u = q[k.op](u, h)(k.field, k.data, f[k.field])),
b++;
g && u.orEnd()
} catch (m) {
alert(m)
}
}
var d = a.p.multiSort ? [] : "",
e = [],
g = !1,
f = {},
h = [],
k = [],
l,
m,
n;
if (b.isArray(a.p.data)) {
var p = a.p.grouping ? a.p.groupingView : !1,
A,
r;
b.each(a.p.colModel,
function () {
m = this.sorttype || "text";
"date" === m || "datetime" === m ? (this.formatter && "string" === typeof this.formatter && "date" === this.formatter ? (l = this.formatoptions && this.formatoptions.srcformat ? this.formatoptions.srcformat : b.jgrid.formatter.date.srcformat, n = this.formatoptions && this.formatoptions.newformat ? this.formatoptions.newformat : b.jgrid.formatter.date.newformat) : l = n = this.datefmt || "Y-m-d", f[this.name] = {
stype: m,
srcfmt: l,
newfmt: n,
sfunc: this.sortfunc || null
}) : f[this.name] = {
stype: m,
srcfmt: "",
newfmt: "",
sfunc: this.sortfunc || null
};
if (a.p.grouping) for (r = 0, A = p.groupField.length; r < A; r++) if (this.name === p.groupField[r]) {
var c = this.name;
this.index && (c = this.index);
h[r] = f[c];
k[r] = c
}
a.p.multiSort ? this.lso && (d.push(this.name), c = this.lso.split("-"), e.push(c[c.length - 1])) : g || this.index !== a.p.sortname && this.name !== a.p.sortname || (d = this.name, g = !0)
});
if (a.p.treeGrid) b(a).jqGrid("SortTree", d, a.p.sortorder, f[d].stype || "text", f[d].srcfmt || "");
else {
var q = {
eq: function (a) {
return a.equals
},
ne: function (a) {
return a.notEquals
},
lt: function (a) {
return a.less
},
le: function (a) {
return a.lessOrEquals
},
gt: function (a) {
return a.greater
},
ge: function (a) {
return a.greaterOrEquals
},
cn: function (a) {
return a.contains
},
nc: function (a, b) {
return "OR" === b ? a.orNot().contains : a.andNot().contains
},
bw: function (a) {
return a.startsWith
},
bn: function (a, b) {
return "OR" === b ? a.orNot().startsWith : a.andNot().startsWith
},
en: function (a, b) {
return "OR" === b ? a.orNot().endsWith : a.andNot().endsWith
},
ew: function (a) {
return a.endsWith
},
ni: function (a, b) {
return "OR" === b ? a.orNot().equals : a.andNot().equals
},
"in": function (a) {
return a.equals
},
nu: function (a) {
return a.isNull
},
nn: function (a, b) {
return "OR" === b ? a.orNot().isNull : a.andNot().isNull
}
},
u = b.jgrid.from(a.p.data);
a.p.ignoreCase && (u = u.ignoreCase());
if (!0 === a.p.search) {
var z = a.p.postData.filters;
if (z) "string" === typeof z && (z = b.jgrid.parse(z)),
c(z);
else try {
u = q[a.p.postData.searchOper](u)(a.p.postData.searchField, a.p.postData.searchString, f[a.p.postData.searchField])
} catch (t) { }
}
if (a.p.grouping) for (r = 0; r < A; r++) u.orderBy(k[r], p.groupOrder[r], h[r].stype, h[r].srcfmt);
a.p.multiSort ? b.each(d,
function (a) {
u.orderBy(this, e[a], f[this].stype, f[this].srcfmt, f[this].sfunc)
}) : d && a.p.sortorder && g && ("DESC" === a.p.sortorder.toUpperCase() ? u.orderBy(a.p.sortname, "d", f[d].stype, f[d].srcfmt, f[d].sfunc) : u.orderBy(a.p.sortname, "a", f[d].stype, f[d].srcfmt, f[d].sfunc));
var z = u.select(),
x = parseInt(a.p.rowNum, 10),
y = z.length,
B = parseInt(a.p.page, 10),
D = Math.ceil(y / x),
v = {};
if ((a.p.search || a.p.resetsearch) && a.p.grouping && a.p.groupingView._locgr) {
a.p.groupingView.groups = [];
var w, G = b.jgrid.getMethod("groupingPrepare"),
s,
F;
if (a.p.footerrow && a.p.userDataOnFooter) {
for (s in a.p.userData) a.p.userData.hasOwnProperty(s) && (a.p.userData[s] = 0);
F = !0
}
for (w = 0; w < y; w++) {
if (F) for (s in a.p.userData) a.p.userData[s] += parseFloat(z[w][s] || 0);
G.call(b(a), z[w], w, x)
}
}
z = z.slice((B - 1) * x, B * x);
f = u = null;
v[a.p.localReader.total] = D;
v[a.p.localReader.page] = B;
v[a.p.localReader.records] = y;
v[a.p.localReader.root] = z;
v[a.p.localReader.userdata] = a.p.userData;
z = null;
return v
}
}
},
P = function () {
a.grid.hDiv.loading = !0;
if (!a.p.hiddengrid) switch (a.p.loadui) {
case "enable":
window.setTimeout(function () {
Loading(true);
top.$("#loading_manage").attr('isTableLoading', 'true')
},
0);
b("#load_" + b.jgrid.jqID(a.p.id)).next().find('.ui-jqgrid-bdiv').find("span").remove();
break;
case "block":
b("#lui_" + b.jgrid.jqID(a.p.id)).show(),
b("#load_" + b.jgrid.jqID(a.p.id)).show()
}
},
T = function () {
a.grid.hDiv.loading = !1;
switch (a.p.loadui) {
case "enable":
window.setTimeout(function () {
top.$("#loading_manage").removeAttr('isTableLoading');
Loading(false)
},
100);
if (a.p.unwritten) {
var c = b.jgrid.jqID(a.p.id);
b("#load_" + c).next().find('.ui-jqgrid-bdiv').find(".unwritten").remove();
var d = b("#load_" + c).next().find('.ui-jqgrid-bdiv').find('table tr').length;
if (d == 1) {
b("#load_" + c).next().find('.ui-jqgrid-bdiv').append('
没有找到您要的相关数据!
')
}
}
break;
case "block":
b("#lui_" + b.jgrid.jqID(a.p.id)).hide(),
b("#load_" + b.jgrid.jqID(a.p.id)).hide()
}
},
Q = function (c) {
if (!a.grid.hDiv.loading) {
var d = a.p.scroll && !1 === c,
e = {},
g, f = a.p.prmNames;
0 >= a.p.page && (a.p.page = Math.min(1, a.p.lastpage));
null !== f.search && (e[f.search] = a.p.search);
null !== f.nd && (e[f.nd] = (new Date).getTime());
null !== f.rows && (e[f.rows] = a.p.rowNum);
null !== f.page && (e[f.page] = a.p.page);
null !== f.sort && (e[f.sort] = a.p.sortname);
null !== f.order && (e[f.order] = a.p.sortorder);
null !== a.p.rowTotal && null !== f.totalrows && (e[f.totalrows] = a.p.rowTotal);
var h = b.isFunction(a.p.loadComplete),
k = h ? a.p.loadComplete : null,
l = 0;
c = c || 1;
1 < c ? null !== f.npage ? (e[f.npage] = c, l = c - 1, c = 1) : k = function (b) {
a.p.page++;
a.grid.hDiv.loading = !1;
h && a.p.loadComplete.call(a, b);
Q(c - 1)
} : null !== f.npage && delete a.p.postData[f.npage];
if (a.p.grouping) {
b(a).jqGrid("groupingSetup");
var m = a.p.groupingView,
n, p = "";
for (n = 0; n < m.groupField.length; n++) {
var r = m.groupField[n];
b.each(a.p.colModel,
function (a, b) {
b.name === r && b.index && (r = b.index)
});
p += r + " " + m.groupOrder[n] + ", "
}
e[f.sort] = p + e[f.sort]
}
b.extend(a.p.postData, e);
var q = a.p.scroll ? a.rows.length - 1 : 1,
e = b(a).triggerHandler("jqGridBeforeRequest");
if (!1 !== e && "stop" !== e) if (b.isFunction(a.p.datatype)) a.p.datatype.call(a, a.p.postData, "load_" + a.p.id, q, c, l);
else {
if (b.isFunction(a.p.beforeRequest) && (e = a.p.beforeRequest.call(a), void 0 === e && (e = !0), !1 === e)) return;
g = a.p.datatype.toLowerCase();
switch (g) {
case "json":
case "jsonp":
case "xml":
case "script":
b.ajax(b.extend({
url:
a.p.url,
type: a.p.mtype,
dataType: g,
data: b.isFunction(a.p.serializeGridData) ? a.p.serializeGridData.call(a, a.p.postData) : a.p.postData,
success: function (e, f, h) {
if (e != null && e.costtime != null) {
a.p.costtime = e.costtime
}
if (b.isFunction(a.p.beforeProcessing) && !1 === a.p.beforeProcessing.call(a, e, f, h)) T();
else {
"xml" === g ? K(e, a.grid.bDiv, q, 1 < c, l) : Y(e, a.grid.bDiv, q, 1 < c, l);
b(a).triggerHandler("jqGridLoadComplete", [e]);
k && k.call(a, e);
b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
d && a.grid.populateVisible();
if (a.p.loadonce || a.p.treeGrid) a.p.datatype = "local";
1 === c && T()
}
},
error: function (d, e, f) {
b.isFunction(a.p.loadError) && a.p.loadError.call(a, d, e, f);
1 === c && T()
},
beforeSend: function (c, d) {
var e = !0;
b.isFunction(a.p.loadBeforeSend) && (e = a.p.loadBeforeSend.call(a, c, d));
void 0 === e && (e = !0);
if (!1 === e) return !1;
P()
}
},
b.jgrid.ajaxOptions, a.p.ajaxGridOptions));
break;
case "xmlstring":
P();
e = "string" !== typeof a.p.datastr ? a.p.datastr : b.parseXML(a.p.datastr);
K(e, a.grid.bDiv);
b(a).triggerHandler("jqGridLoadComplete", [e]);
h && a.p.loadComplete.call(a, e);
b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
a.p.datatype = "local";
a.p.datastr = null;
T();
break;
case "jsonstring":
P();
e = "string" === typeof a.p.datastr ? b.jgrid.parse(a.p.datastr) : a.p.datastr;
Y(e, a.grid.bDiv);
b(a).triggerHandler("jqGridLoadComplete", [e]);
h && a.p.loadComplete.call(a, e);
b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
a.p.datatype = "local";
a.p.datastr = null;
T();
break;
case "local":
case "clientside":
P(),
a.p.datatype = "local",
e = oa(),
Y(e, a.grid.bDiv, q, 1 < c, l),
b(a).triggerHandler("jqGridLoadComplete", [e]),
k && k.call(a, e),
b(a).triggerHandler("jqGridAfterLoadComplete", [e]),
d && a.grid.populateVisible(),
T()
}
}
}
},
ha = function (c) {
b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv)[a.p.useProp ? "prop" : "attr"]("checked", c);
if (a.p.frozenColumns && a.p.id + "_frozen") b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.fhDiv)[a.p.useProp ? "prop" : "attr"]("checked", c)
},
qa = function (c, e) {
var d = "",
g = "
",
k = "",
l, m, n, p, q = function (c) {
var e;
b.isFunction(a.p.onPaging) && (e = a.p.onPaging.call(a, c));
if ("stop" === e) return !1;
a.p.selrow = null;
a.p.multiselect && (a.p.selarrrow = [], ha(!1));
a.p.savedRow = [];
return !0
};
c = c.substr(1);
e += "_" + c;
l = "pg_" + c;
m = c + "_left";
n = c + "_center";
p = c + "_right";
b("#" + b.jgrid.jqID(c)).append("
").attr("dir", "ltr");
if (0 < a.p.rowList.length) {
k = "
"); !0 === a.p.pgbuttons ? (m = ["first" + e, "prev" + e, "next" + e, "last" + e], "rtl" === f && m.reverse(), g += "
", g += "
", g = g + ("" !== d ? "
" + d + "
" : "") + ("
"), g += "
") : "" !== d && (g += d);
"ltr" === f && (g += k);
g += "
"; !0 === a.p.viewrecords && b("td#" + c + "_" + a.p.recordpos, "#" + l).append("");
b("td#" + c + "_" + a.p.pagerpos, "#" + l).append(g);
k = b(".ui-jqgrid").css("font-size") || "11px";
b(document.body).append("");
g = b(g).clone().appendTo("#testpg").width();
b("#testpg").remove();
0 < g && ("" !== d && (g += 50), b("td#" + c + "_" + a.p.pagerpos, "#" + l).width(g - 25));
a.p._nvtd = [];
a.p._nvtd[0] = g ? Math.floor((a.p.width - g) / 2) : Math.floor(a.p.width / 3);
a.p._nvtd[1] = 0;
g = null;
b(".ui-pg-selbox", "#" + l).bind("change",
function () {
if (!q("records")) return !1;
a.p.page = Math.round(a.p.rowNum * (a.p.page - 1) / this.value - 0.5) + 1;
a.p.rowNum = this.value;
a.p.pager && b(".ui-pg-selbox", a.p.pager).val(this.value);
a.p.toppager && b(".ui-pg-selbox", a.p.toppager).val(this.value);
Q();
return !1
}); !0 === a.p.pgbuttons && (b(".ui-pg-button", "#" + l).hover(function () {
b(this).hasClass("ui-state-disabled") ? this.style.cursor = "default" : (b(this).addClass("ui-state-hover"), this.style.cursor = "pointer")
},
function () {
b(this).hasClass("ui-state-disabled") || (b(this).removeClass("ui-state-hover"), this.style.cursor = "default")
}), b("#first" + b.jgrid.jqID(e) + ", #prev" + b.jgrid.jqID(e) + ", #next" + b.jgrid.jqID(e) + ", #last" + b.jgrid.jqID(e)).click(function () {
if (b(this).hasClass("ui-state-disabled")) return !1;
var c = r(a.p.page, 1),
d = r(a.p.lastpage, 1),
g = !1,
f = !0,
h = !0,
k = !0,
l = !0;
0 === d || 1 === d ? l = k = h = f = !1 : 1 < d && 1 <= c ? 1 === c ? h = f = !1 : c === d && (l = k = !1) : 1 < d && 0 === c && (l = k = !1, c = d - 1);
if (!q(this.id)) return !1;
this.id === "first" + e && f && (a.p.page = 1, g = !0);
this.id === "prev" + e && h && (a.p.page = c - 1, g = !0);
this.id === "next" + e && k && (a.p.page = c + 1, g = !0);
this.id === "last" + e && l && (a.p.page = d, g = !0);
g && Q();
return !1
})); !0 === a.p.pginput && b("input.ui-pg-input", "#" + l).keypress(function (c) {
if (13 === (c.charCode || c.keyCode || 0)) {
if (!q("user")) return !1;
b(this).val(r(b(this).val(), 1));
a.p.page = 0 < b(this).val() ? b(this).val() : a.p.page;
Q();
return !1
}
return this
})
},
wa = function (c, e) {
var d, g = "",
f = a.p.colModel,
h = !1,
k;
k = a.p.frozenColumns ? e : a.grid.headers[c].el;
var l = "";
b("span.ui-grid-ico-sort", k).addClass("ui-state-disabled");
b(k).attr("aria-selected", "false");
if (f[c].lso) if ("asc" === f[c].lso) f[c].lso += "-desc",
l = "desc";
else if ("desc" === f[c].lso) f[c].lso += "-asc",
l = "asc";
else {
if ("asc-desc" === f[c].lso || "desc-asc" === f[c].lso) f[c].lso = ""
} else f[c].lso = l = f[c].firstsortorder || "asc";
l ? (b("span.s-ico", k).show(), b("span.ui-icon-" + l, k).removeClass("ui-state-disabled"), b(k).attr("aria-selected", "true")) : a.p.viewsortcols[0] || b("span.s-ico", k).hide();
a.p.sortorder = "";
b.each(f,
function (b) {
this.lso && (0 < b && h && (g += ", "), d = this.lso.split("-"), g += f[b].index || f[b].name, g += " " + d[d.length - 1], h = !0, a.p.sortorder = d[d.length - 1])
});
k = g.lastIndexOf(a.p.sortorder);
g = g.substring(0, k);
a.p.sortname = g
},
ra = function (c, d, e, g, f) {
if (a.p.colModel[d].sortable && !(0 < a.p.savedRow.length)) {
e || (a.p.lastsort === d ? "asc" === a.p.sortorder ? a.p.sortorder = "desc" : "desc" === a.p.sortorder && (a.p.sortorder = "asc") : a.p.sortorder = a.p.colModel[d].firstsortorder || "asc", a.p.page = 1);
if (a.p.multiSort) wa(d, f);
else {
if (g) {
if (a.p.lastsort === d && a.p.sortorder === g && !e) return;
a.p.sortorder = g
}
e = a.grid.headers[a.p.lastsort].el;
f = a.p.frozenColumns ? f : a.grid.headers[d].el;
b("span.ui-grid-ico-sort", e).addClass("ui-state-disabled");
b(e).attr("aria-selected", "false");
a.p.frozenColumns && (a.grid.fhDiv.find("span.ui-grid-ico-sort").addClass("ui-state-disabled"), a.grid.fhDiv.find("th").attr("aria-selected", "false"));
b("span.ui-icon-" + a.p.sortorder, f).removeClass("ui-state-disabled");
b(f).attr("aria-selected", "true");
a.p.viewsortcols[0] || a.p.lastsort === d || (a.p.frozenColumns && a.grid.fhDiv.find("span.s-ico").hide(), b("span.s-ico", e).hide(), b("span.s-ico", f).show());
c = c.substring(5 + a.p.id.length + 1);
a.p.sortname = a.p.colModel[d].index || c
}
"stop" === b(a).triggerHandler("jqGridSortCol", [a.p.sortname, d, a.p.sortorder]) ? a.p.lastsort = d : b.isFunction(a.p.onSortCol) && "stop" === a.p.onSortCol.call(a, a.p.sortname, d, a.p.sortorder) ? a.p.lastsort = d : ("local" === a.p.datatype ? a.p.deselectAfterSort && b(a).jqGrid("resetSelection") : (a.p.selrow = null, a.p.multiselect && ha(!1), a.p.selarrrow = [], a.p.savedRow = []), a.p.scroll && (f = a.grid.bDiv.scrollLeft, X.call(a, !0, !1), a.grid.hDiv.scrollLeft = f), a.p.subGrid && "local" === a.p.datatype && b("td.sgexpanded", "#" + b.jgrid.jqID(a.p.id)).each(function () {
b(this).trigger("click")
}), Q(), a.p.lastsort = d, a.p.sortname !== c && d && (a.p.lastsort = d))
}
},
xa = function (c) {
c = b(a.grid.headers[c].el);
c = [c.position().left + c.outerWidth()];
"rtl" === a.p.direction && (c[0] = a.p.width - c[0]);
c[0] -= a.grid.bDiv.scrollLeft;
c.push(b(a.grid.hDiv).position().top);
c.push(b(a.grid.bDiv).offset().top - b(a.grid.hDiv).offset().top + b(a.grid.bDiv).height());
return c
},
sa = function (c) {
var d, e = a.grid.headers,
g = b.jgrid.getCellIndex(c);
for (d = 0; d < e.length; d++) if (c === e[d].el) {
g = d;
break
}
return g
};
this.p.id = this.id; -1 === b.inArray(a.p.multikey, ["shiftKey", "altKey", "ctrlKey"]) && (a.p.multikey = !1);
a.p.keyIndex = !1;
a.p.keyName = !1;
for (g = 0; g < a.p.colModel.length; g++) a.p.colModel[g] = b.extend(!0, {},
a.p.cmTemplate, a.p.colModel[g].template || {},
a.p.colModel[g]),
!1 === a.p.keyIndex && !0 === a.p.colModel[g].key && (a.p.keyIndex = g);
a.p.sortorder = a.p.sortorder.toLowerCase();
b.jgrid.cell_width = b.jgrid.cellWidth(); !0 === a.p.grouping && (a.p.scroll = !1, a.p.rownumbers = !1, a.p.treeGrid = !1, a.p.gridview = !0);
if (!0 === this.p.treeGrid) {
try {
b(this).jqGrid("setTreeGrid")
} catch (za) { }
"local" !== a.p.datatype && (a.p.localReader = {
id: "_id_"
})
}
if (this.p.subGrid) try {
b(a).jqGrid("setSubGrid")
} catch (Aa) { }
this.p.multiselect && (this.p.colNames.unshift(""), this.p.colModel.unshift({
name: "cb",
width: b.jgrid.cell_width ? a.p.multiselectWidth + a.p.cellLayout : a.p.multiselectWidth,
sortable: !1,
resizable: !1,
hidedlg: !0,
search: !1,
align: "center",
fixed: !0
}));
this.p.rownumbers && (this.p.colNames.unshift(""), this.p.colModel.unshift({
name: "rn",
width: a.p.rownumWidth,
sortable: !1,
resizable: !1,
hidedlg: !0,
search: !1,
align: "center",
fixed: !0
}));
a.p.xmlReader = b.extend(!0, {
root: "rows",
row: "row",
page: "rows>page",
total: "rows>total",
records: "rows>records",
repeatitems: !0,
cell: "cell",
id: "[id]",
userdata: "userdata",
subgrid: {
root: "rows",
row: "row",
repeatitems: !0,
cell: "cell"
}
},
a.p.xmlReader);
a.p.jsonReader = b.extend(!0, {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: !0,
cell: "cell",
id: "id",
userdata: "userdata",
subgrid: {
root: "rows",
repeatitems: !0,
cell: "cell"
}
},
a.p.jsonReader);
a.p.localReader = b.extend(!0, {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: !1,
cell: "cell",
id: "id",
userdata: "userdata",
subgrid: {
root: "rows",
repeatitems: !0,
cell: "cell"
}
},
a.p.localReader);
a.p.scroll && (a.p.pgbuttons = !1, a.p.pginput = !1, a.p.rowList = []);
a.p.data.length && O();
var D = "
",
ta, F, ja, fa, ka, y, t, ba, ua = ba = "",
ga = [],
va = [];
F = [];
if (!0 === a.p.shrinkToFit && !0 === a.p.forceFit) for (g = a.p.colModel.length - 1; 0 <= g; g--) if (!a.p.colModel[g].hidden) {
a.p.colModel[g].resizable = !1;
break
}
"horizontal" === a.p.viewsortcols[1] && (ba = " ui-i-asc", ua = " ui-i-desc");
ta = n ? "class='ui-th-div-ie'" : "";
ba = "" + ("");
if (a.p.multiSort) for (ga = a.p.sortname.split(","), g = 0; g < ga.length; g++) F = b.trim(ga[g]).split(" "),
ga[g] = b.trim(F[0]),
va[g] = F[1] ? b.trim(F[1]) : a.p.sortorder || "asc";
var j = 0;
var o = 0;
for (g = 0; g < this.p.colNames.length; g++) {
var bb = a.p.colModel[g].hidden;
if (a.p.colModel[g].autowidth == true) {
o = g;
break
}
if (bb == undefined) {
o = g
}
}
for (g = 0; g < this.p.colNames.length; g++) {
var bb = a.p.colModel[g].hidden;
var bc = a.p.colModel[g].width;
if (bb != undefined) {
bc = 0
} else {
j += bc
}
if (g == o) {
if (b("#gview_" + a.p.id).width() > j) {
if (a.p.colModel[g].autowidth == true || a.p.colModel[g].autowidth == undefined) {
bc = bc + b("#gview_" + a.p.id).width() - j - 20
}
}
}
F = a.p.headertitles ? ' title="' + b.jgrid.stripHtml(a.p.colNames[g]) + '"' : "",
//D += "
",
D += "
",
F = a.p.colModel[g].index || a.p.colModel[g].name,
D += "
" + a.p.colNames[g],
a.p.colModel[g].width = bc ? parseInt(bc, 10) : 150,
"boolean" !== typeof a.p.colModel[g].title && (a.p.colModel[g].title = !0),
a.p.colModel[g].lso = "",
F === a.p.sortname && (a.p.lastsort = g),
a.p.multiSort && (F = b.inArray(F, ga), -1 !== F && (a.p.colModel[g].lso = va[F])),
D += ba + "
"
}
D += "
";
ba = null;
b(this).append(D);
function widthCount(a, b) {
return a
};
b("thead tr:first th", this).hover(function () { },
function () {
b(this).removeClass("ui-state-hover")
});
if (this.p.multiselect) {
var bd = [],
ca;
b("#cb_" + b.jgrid.jqID(a.p.id), this).bind("click",
function () {
a.p.selarrrow = [];
var c = !0 === a.p.frozenColumns ? a.p.id + "_frozen" : "";
this.checked ? (b(a.rows).each(function (d) {
0 < d && !b(this).hasClass("ui-subgrid") && !b(this).hasClass("jqgroup") && !b(this).hasClass("ui-state-disabled") && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id))[a.p.useProp ? "prop" : "attr"]("checked", !0), b(this).addClass("ui-state-highlight").attr("aria-selected", "true"), a.p.selarrrow.push(this.id), a.p.selrow = this.id, c && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id), a.grid.fbDiv)[a.p.useProp ? "prop" : "attr"]("checked", !0), b("#" + b.jgrid.jqID(this.id), a.grid.fbDiv).addClass("ui-state-highlight")))
}), ca = !0, bd = []) : (b(a.rows).each(function (d) {
0 < d && !b(this).hasClass("ui-subgrid") && !b(this).hasClass("ui-state-disabled") && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id))[a.p.useProp ? "prop" : "attr"]("checked", !1), b(this).removeClass("ui-state-highlight").attr("aria-selected", "false"), bd.push(this.id), c && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id), a.grid.fbDiv)[a.p.useProp ? "prop" : "attr"]("checked", !1), b("#" + b.jgrid.jqID(this.id), a.grid.fbDiv).removeClass("ui-state-highlight")))
}), a.p.selrow = null, ca = !1);
b(a).triggerHandler("jqGridSelectAll", [ca ? a.p.selarrrow : bd, ca]);
b.isFunction(a.p.onSelectAll) && a.p.onSelectAll.call(a, ca ? a.p.selarrrow : bd, ca)
})
} !0 === a.p.autowidth && (D = b(m).innerWidth(), a.p.width = 0 < D ? D : "nw"); (function () {
var d = 0,
e = b.jgrid.cell_width ? 0 : r(a.p.cellLayout, 0),
g = 0,
f,
h = r(a.p.scrollOffset, 0),
k,
m = !1,
n,
p = 0,
q;
b.each(a.p.colModel,
function () {
void 0 === this.hidden && (this.hidden = !1);
if (a.p.grouping && a.p.autowidth) {
var c = b.inArray(this.name, a.p.groupingView.groupField);
0 <= c && a.p.groupingView.groupColumnShow.length > c && (this.hidden = !a.p.groupingView.groupColumnShow[c])
}
this.widthOrg = k = r(this.width, 0); !1 === this.hidden && (d += k + e, this.fixed ? p += k + e : g++)
});
isNaN(a.p.width) && (a.p.width = d + (!1 !== a.p.shrinkToFit || isNaN(a.p.height) ? 0 : h));
c.width = a.p.width;
a.p.tblwidth = d; !1 === a.p.shrinkToFit && !0 === a.p.forceFit && (a.p.forceFit = !1); !0 === a.p.shrinkToFit && 0 < g && (n = c.width - e * g - p, isNaN(a.p.height) || (n -= h, m = !0), d = 0, b.each(a.p.colModel,
function (b) {
!1 !== this.hidden || this.fixed || (this.width = k = Math.round(n * this.width / (a.p.tblwidth - e * g - p)), d += k, f = b)
}), q = 0, m ? c.width - p - (d + e * g) !== h && (q = c.width - p - (d + e * g) - h) : m || 1 === Math.abs(c.width - p - (d + e * g)) || (q = c.width - p - (d + e * g)), a.p.colModel[f].width += q, a.p.tblwidth = d + q + e * g + p, a.p.tblwidth > a.p.width && (a.p.colModel[f].width -= a.p.tblwidth - parseInt(a.p.width, 10), a.p.tblwidth = a.p.width))
})();
b(m).css("width", c.width + "px").append("
");
b(k).css("width", c.width + "px");
var D = b("thead:first", a).get(0),
V = "";
a.p.footerrow && (V += "
");
var k = b("tr:first", D),
be = "
";
a.p.disableClick = !1;
b("th", k).each(function (d) {
ja = a.p.colModel[d].width;
void 0 === a.p.colModel[d].resizable && (a.p.colModel[d].resizable = !0);
a.p.colModel[d].resizable ? (fa = document.createElement("span"), b(fa).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-" + f).css("cursor", "col-resize"), b(this).addClass(a.p.resizeclass)) : fa = "";
b(this).css("width", ja + "px").prepend(fa);
fa = null;
var e = "";
a.p.colModel[d].hidden && (b(this).css("display", "none"), e = "display:none;");
be += "
";
c.headers[d] = {
width: ja,
el: this
};
ka = a.p.colModel[d].sortable;
"boolean" !== typeof ka && (ka = a.p.colModel[d].sortable = !0);
e = a.p.colModel[d].name;
"cb" !== e && "subgrid" !== e && "rn" !== e && a.p.viewsortcols[2] && b(">div", this).addClass("ui-jqgrid-sortable");
ka && (a.p.multiSort ? a.p.viewsortcols[0] ? (b("div span.s-ico", this).show(), a.p.colModel[d].lso && b("div span.ui-icon-" + a.p.colModel[d].lso, this).removeClass("ui-state-disabled")) : a.p.colModel[d].lso && (b("div span.s-ico", this).show(), b("div span.ui-icon-" + a.p.colModel[d].lso, this).removeClass("ui-state-disabled")) : a.p.viewsortcols[0] ? (b("div span.s-ico", this).show(), d === a.p.lastsort && b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")) : d === a.p.lastsort && (b("div span.s-ico", this).show(), b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")));
a.p.footerrow && (V += "
")
}).mousedown(function (d) {
if (1 === b(d.target).closest("th>span.ui-jqgrid-resize").length) {
var e = sa(this);
if (!0 === a.p.forceFit) {
var g = a.p,
f = e,
h;
for (h = e + 1; h < a.p.colModel.length; h++) if (!0 !== a.p.colModel[h].hidden) {
f = h;
break
}
g.nv = f - e
}
c.dragStart(e, d, xa(e));
return !1
}
}).click(function (c) {
if (a.p.disableClick) return a.p.disableClick = !1;
var d = "th>div.ui-jqgrid-sortable",
e, g;
a.p.viewsortcols[2] || (d = "th>div>span>span.ui-grid-ico-sort");
c = b(c.target).closest(d);
if (1 === c.length) {
var f;
if (a.p.frozenColumns) {
var h = b(this)[0].id.substring(a.p.id.length + 1);
b(a.p.colModel).each(function (a) {
if (this.name === h) return f = a,
!1
})
} else f = sa(this);
a.p.viewsortcols[2] || (e = !0, g = c.attr("sort"));
null != f && ra(b("div", this)[0].id, f, e, g, this);
return !1
}
});
if (a.p.sortable && b.fn.sortable) try {
b(a).jqGrid("sortableColumns", k)
} catch (Ba) { }
a.p.footerrow && (V += "
");
be += "";
k = document.createElement("tbody");
this.appendChild(k);
b(this).addClass("ui-jqgrid-btable").append(be);
var be = null,
k = b("
");
D = null;
c.hDiv = document.createElement("div");
b(c.hDiv).css({
width: c.width + "px"
}).addClass("ui-state-default ui-jqgrid-hdiv").append(g);
b(g).append(k);
k = null;
J && b(c.hDiv).hide();
a.p.pager && ("string" === typeof a.p.pager ? "#" !== a.p.pager.substr(0, 1) && (a.p.pager = "#" + a.p.pager) : a.p.pager = "#" + b(a.p.pager).attr("id"), b(a.p.pager).css({
width: c.width + "px"
}).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom").appendTo(m), J && b(a.p.pager).hide(), qa(a.p.pager, "")); !1 === a.p.cellEdit && !0 === a.p.hoverrows && b(a).bind("mouseover",
function (a) {
t = b(a.target).closest("tr.jqgrow");
"ui-subgrid" !== b(t).attr("class") && b(t).addClass("ui-state-hover")
}).bind("mouseout",
function (a) {
t = b(a.target).closest("tr.jqgrow");
b(t).removeClass("ui-state-hover")
});
var B, N, ma;
b(a).before(c.hDiv).click(function (c) {
y = c.target;
t = b(y, a.rows).closest("tr.jqgrow");
if (0 === b(t).length || -1 < t[0].className.indexOf("ui-state-disabled") || (b(y, a).closest("table.ui-jqgrid-btable").attr("id") || "").replace("_frozen", "") !== a.id) return this;
var d = b(y).hasClass("cbox"),
e = b(a).triggerHandler("jqGridBeforeSelectRow", [t[0].id, c]); (e = !1 === e || "stop" === e ? !1 : !0) && b.isFunction(a.p.beforeSelectRow) && (e = a.p.beforeSelectRow.call(a, t[0].id, c));
if ("A" !== y.tagName && ("INPUT" !== y.tagName && "TEXTAREA" !== y.tagName && "OPTION" !== y.tagName && "SELECT" !== y.tagName || d) && !0 === e) if (B = t[0].id, N = b.jgrid.getCellIndex(y), ma = b(y).closest("td,th").html(), b(a).triggerHandler("jqGridCellSelect", [B, N, ma, c]), b.isFunction(a.p.onCellSelect) && a.p.onCellSelect.call(a, B, N, ma, c), !0 === a.p.cellEdit) if (a.p.multiselect && d) b(a).jqGrid("setSelection", B, !0, c);
else {
B = t[0].rowIndex;
try {
b(a).jqGrid("editCell", B, N, !0)
} catch (g) { }
} else if (a.p.multikey) c[a.p.multikey] ? b(a).jqGrid("setSelection", B, !0, c) : a.p.multiselect && d && (d = b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + B).is(":checked"), b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + B)[a.p.useProp ? "prop" : "attr"]("checked", d));
else {
if (a.p.multiselect && a.p.multiboxonly && !d) {
var f = a.p.frozenColumns ? a.p.id + "_frozen" : "";
b(a.p.selarrrow).each(function (c, d) {
var e = b(a).jqGrid("getGridRowById", d);
b(e).removeClass("ui-state-highlight");
b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d))[a.p.useProp ? "prop" : "attr"]("checked", !1);
f && (b("#" + b.jgrid.jqID(d), "#" + b.jgrid.jqID(f)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d), "#" + b.jgrid.jqID(f))[a.p.useProp ? "prop" : "attr"]("checked", !1))
});
a.p.selarrrow = []
}
b(a).jqGrid("setSelection", B, !0, c)
}
}).bind("reloadGrid",
function (c, d) {
!0 === a.p.treeGrid && (a.p.datatype = a.p.treedatatype);
d && d.current && a.grid.selectionPreserver(a);
"local" === a.p.datatype ? (b(a).jqGrid("resetSelection"), a.p.data.length && O()) : a.p.treeGrid || (a.p.selrow = null, a.p.multiselect && (a.p.selarrrow = [], ha(!1)), a.p.savedRow = []);
a.p.scroll && X.call(a, !0, !1);
if (d && d.page) {
var e = d.page;
e > a.p.lastpage && (e = a.p.lastpage);
1 > e && (e = 1);
a.p.page = e;
a.grid.bDiv.scrollTop = a.grid.prevRowHeight ? (e - 1) * a.grid.prevRowHeight * a.p.rowNum : 0
}
a.grid.prevRowHeight && a.p.scroll ? (delete a.p.lastpage, a.grid.populateVisible()) : a.grid.populate(); !0 === a.p._inlinenav && b(a).jqGrid("showAddEditButtons");
return !1
}).dblclick(function (c) {
y = c.target;
t = b(y, a.rows).closest("tr.jqgrow");
0 !== b(t).length && (B = t[0].rowIndex, N = b.jgrid.getCellIndex(y), b(a).triggerHandler("jqGridDblClickRow", [b(t).attr("id"), B, N, c]), b.isFunction(a.p.ondblClickRow) && a.p.ondblClickRow.call(a, b(t).attr("id"), B, N, c))
}).bind("contextmenu",
function (c) { });
c.bDiv = document.createElement("div");
n && "auto" === String(a.p.height).toLowerCase() && (a.p.height = "100%");
b(c.bDiv).append(b('').append("").append(this)).addClass("ui-jqgrid-bdiv").css({
height: a.p.height + (isNaN(a.p.height) ? "" : "px"),
width: c.width + "px"
}).scroll(c.scrollGrid);
b("table:first", c.bDiv).css({
width: a.p.tblwidth + "px"
});
b.support.tbody || 2 === b("tbody", this).length && b("tbody:gt(0)", this).remove();
a.p.multikey && (b.jgrid.msie ? b(c.bDiv).bind("selectstart",
function () {
return !1
}) : b(c.bDiv).bind("mousedown",
function () {
return !1
}));
J && b(c.bDiv).hide();
c.cDiv = document.createElement("div");
var bf = !0 === a.p.hidegrid ? b("").hover(function () {
bf.addClass("ui-state-hover")
},
function () {
bf.removeClass("ui-state-hover")
}).append("").css("rtl" === f ? "left" : "right", "0px") : "";
b(c.cDiv).append(bf).append("" + a.p.caption + "").addClass("ui-jqgrid-titlebar ui-jqgrid-caption" + ("rtl" === f ? "-rtl" : "") + " ui-widget-header ui-corner-top ui-helper-clearfix");
b(c.cDiv).insertBefore(c.hDiv);
a.p.toolbar[0] && (c.uDiv = document.createElement("div"), "top" === a.p.toolbar[1] ? b(c.uDiv).insertBefore(c.hDiv) : "bottom" === a.p.toolbar[1] && b(c.uDiv).insertAfter(c.hDiv), "both" === a.p.toolbar[1] ? (c.ubDiv = document.createElement("div"), b(c.uDiv).addClass("ui-userdata ui-state-default").attr("id", "t_" + this.id).insertBefore(c.hDiv), b(c.ubDiv).addClass("ui-userdata ui-state-default").attr("id", "tb_" + this.id).insertAfter(c.hDiv), J && b(c.ubDiv).hide()) : b(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id", "t_" + this.id), J && b(c.uDiv).hide());
a.p.toppager && (a.p.toppager = b.jgrid.jqID(a.p.id) + "_toppager", c.topDiv = b("")[0], a.p.toppager = "#" + a.p.toppager, b(c.topDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width).insertBefore(c.hDiv), qa(a.p.toppager, "_t"));
a.p.footerrow && (c.sDiv = b("")[0], g = b(""), b(c.sDiv).append(g).width(c.width).insertAfter(c.hDiv), b(g).append(V), c.footers = b(".ui-jqgrid-ftable", c.sDiv)[0].rows[0].cells, a.p.rownumbers && (c.footers[0].className = "ui-state-default jqgrid-rownum"), J && b(c.sDiv).hide());
g = null;
if (a.p.caption) {
var bg = a.p.datatype; !0 === a.p.hidegrid && (b(".ui-jqgrid-titlebar-close", c.cDiv).click(function (d) {
var e = b.isFunction(a.p.onHeaderClick),
g = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
f,
h = this; !0 === a.p.toolbar[0] && ("both" === a.p.toolbar[1] && (g += ", #" + b(c.ubDiv).attr("id")), g += ", #" + b(c.uDiv).attr("id"));
f = b(g, "#gview_" + b.jgrid.jqID(a.p.id)).length;
"visible" === a.p.gridstate ? b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideUp("fast",
function () {
f--;
0 === f && (b("span", h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"), a.p.gridstate = "hidden", b("#gbox_" + b.jgrid.jqID(a.p.id)).hasClass("ui-resizable") && b(".ui-resizable-handle", "#gbox_" + b.jgrid.jqID(a.p.id)).hide(), b(a).triggerHandler("jqGridHeaderClick", [a.p.gridstate, d]), e && (J || a.p.onHeaderClick.call(a, a.p.gridstate, d)))
}) : "hidden" === a.p.gridstate && b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideDown("fast",
function () {
f--;
0 === f && (b("span", h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"), J && (a.p.datatype = bg, Q(), J = !1), a.p.gridstate = "visible", b("#gbox_" + b.jgrid.jqID(a.p.id)).hasClass("ui-resizable") && b(".ui-resizable-handle", "#gbox_" + b.jgrid.jqID(a.p.id)).show(), b(a).triggerHandler("jqGridHeaderClick", [a.p.gridstate, d]), e && (J || a.p.onHeaderClick.call(a, a.p.gridstate, d)))
});
return !1
}), J && (a.p.datatype = "local", b(".ui-jqgrid-titlebar-close", c.cDiv).trigger("click")))
} else b(c.cDiv).hide();
b(c.hDiv).after(c.bDiv).mousemove(function (a) {
if (c.resizing) return c.dragMove(a),
!1
});
b(".ui-jqgrid-labels", c.hDiv).bind("selectstart",
function () {
return !1
});
b(document).bind("mouseup.jqGrid" + a.p.id,
function () {
return c.resizing ? (c.dragEnd(), !1) : !0
});
a.formatCol = p;
a.sortData = ra;
a.updatepager = function (c, d) {
var e, g, f, h, k, l, m, n = "",
p = a.p.pager ? "_" + b.jgrid.jqID(a.p.pager.substr(1)) : "",
q = a.p.toppager ? "_" + a.p.toppager.substr(1) : "";
f = parseInt(a.p.page, 10) - 1;
0 > f && (f = 0);
f *= parseInt(a.p.rowNum, 10);
k = f + a.p.reccount;
if (a.p.scroll) {
e = b("tbody:first > tr:gt(0)", a.grid.bDiv);
f = k - e.length;
a.p.reccount = e.length;
if (e = e.outerHeight() || a.grid.prevRowHeight) g = f * e,
m = parseInt(a.p.records, 10) * e,
b(">div:first", a.grid.bDiv).css({
height: m
}).children("div:first").css({
height: g,
display: g ? "" : "none"
}),
0 == a.grid.bDiv.scrollTop && 1 < a.p.page && (a.grid.bDiv.scrollTop = a.p.rowNum * (a.p.page - 1) * e);
a.grid.bDiv.scrollLeft = a.grid.hDiv.scrollLeft
}
n = a.p.pager || "";
if (n += a.p.toppager ? n ? "," + a.p.toppager : a.p.toppager : "") m = b.jgrid.formatter.integer || {},
e = r(a.p.page),
g = r(a.p.lastpage),
b(".selbox", n)[this.p.useProp ? "prop" : "attr"]("disabled", !1),
!0 === a.p.pginput && (b(".ui-pg-input", n).val(a.p.page), h = a.p.toppager ? "#sp_1" + p + ",#sp_1" + q : "#sp_1" + p, b(h).html(b.fmatter ? b.fmatter.util.NumberFormat(a.p.lastpage, m) : a.p.lastpage)),
a.p.viewrecords && (0 === a.p.reccount ? b(".ui-paging-info", n).html(a.p.emptyrecords) : (h = f + 1, l = a.p.records, b.fmatter && (h = b.fmatter.util.NumberFormat(h, m), k = b.fmatter.util.NumberFormat(k, m), l = b.fmatter.util.NumberFormat(l, m)), b(".ui-paging-info", n).html(b.jgrid.format(a.p.recordtext, h.replace(/ /g, ''), k.replace(/ /g, ''), l.replace(/ /g, ''), (Number(a.p.totaltime) + Number(a.p.costtime)))))),
!0 === a.p.pgbuttons && (0 >= e && (e = g = 0), 1 === e || 0 === e ? (b("#first" + p + ", #prev" + p).addClass("ui-state-disabled").removeClass("ui-state-hover"), a.p.toppager && b("#first_t" + q + ", #prev_t" + q).addClass("ui-state-disabled").removeClass("ui-state-hover")) : (b("#first" + p + ", #prev" + p).removeClass("ui-state-disabled"), a.p.toppager && b("#first_t" + q + ", #prev_t" + q).removeClass("ui-state-disabled")), e === g || 0 === e ? (b("#next" + p + ", #last" + p).addClass("ui-state-disabled").removeClass("ui-state-hover"), a.p.toppager && b("#next_t" + q + ", #last_t" + q).addClass("ui-state-disabled").removeClass("ui-state-hover")) : (b("#next" + p + ", #last" + p).removeClass("ui-state-disabled"), a.p.toppager && b("#next_t" + q + ", #last_t" + q).removeClass("ui-state-disabled"))); !0 === c && !0 === a.p.rownumbers && b(">td.jqgrid-rownum", a.rows).each(function (a) {
b(this).html(f + 1 + a)
});
d && a.p.jqgdnd && b(a).jqGrid("gridDnD", "updateDnD");
b(a).triggerHandler("jqGridGridComplete");
b.isFunction(a.p.gridComplete) && a.p.gridComplete.call(a);
b(a).triggerHandler("jqGridAfterGridComplete")
};
a.refreshIndex = O;
a.setHeadCheckBox = ha;
a.constructTr = $;
a.formatter = function (a, b, c, d, e) {
return x(a, b, c, d, e)
};
b.extend(c, {
populate: Q,
emptyRows: X,
beginReq: P,
endReq: T
});
this.grid = c;
a.addXmlData = function (b) {
K(b, a.grid.bDiv)
};
a.addJSONData = function (b) {
Y(b, a.grid.bDiv)
};
this.grid.cols = this.rows[0].cells;
b(a).triggerHandler("jqGridInitGrid");
b.isFunction(a.p.onInitGrid) && a.p.onInitGrid.call(a);
Q();
a.p.hiddengrid = !1
}
}
}
})
};
b.jgrid.extend({
getGridParam: function (b) {
var f = this[0];
if (f && f.grid) return b ? void 0 !== f.p[b] ? f.p[b] : null : f.p
},
setGridParam: function (e) {
return this.each(function () {
this.grid && "object" === typeof e && b.extend(!0, this.p, e)
})
},
getGridRowById: function (e) {
var f;
this.each(function () {
try {
for (var c = this.rows.length; c--;) if (e.toString() === this.rows[c].id) {
f = this.rows[c];
break
}
} catch (d) {
f = b(this.grid.bDiv).find("#" + b.jgrid.jqID(e))
}
});
return f
},
getDataIDs: function () {
var e = [],
f = 0,
c,
d = 0;
this.each(function () {
if ((c = this.rows.length) && 0 < c) for (; f < c;) b(this.rows[f]).hasClass("jqgrow") && (e[d] = this.rows[f].id, d++),
f++
});
return e
},
setSelection: function (e, f, c) {
return this.each(function () {
var d, a, l, g, h, k;
void 0 !== e && (f = !1 === f ? !1 : !0, !(a = b(this).jqGrid("getGridRowById", e)) || !a.className || -1 < a.className.indexOf("ui-state-disabled") || (!0 === this.p.scrollrows && (l = b(this).jqGrid("getGridRowById", e).rowIndex, 0 <= l && (d = b(this.grid.bDiv)[0].clientHeight, g = b(this.grid.bDiv)[0].scrollTop, h = b(this.rows[l]).position().top, l = this.rows[l].clientHeight, h + l >= d + g ? b(this.grid.bDiv)[0].scrollTop = h - (d + g) + l + g : h < d + g && h < g && (b(this.grid.bDiv)[0].scrollTop = h))), !0 === this.p.frozenColumns && (k = this.p.id + "_frozen"), this.p.multiselect ? (this.setHeadCheckBox(!1), this.p.selrow = a.id, g = b.inArray(this.p.selrow, this.p.selarrrow), -1 === g ? ("ui-subgrid" !== a.className && b(a).addClass("ui-state-highlight").attr("aria-selected", "true"), d = !0, this.p.selarrrow.push(this.p.selrow)) : ("ui-subgrid" !== a.className && b(a).removeClass("ui-state-highlight").attr("aria-selected", "false"), d = !1, this.p.selarrrow.splice(g, 1), h = this.p.selarrrow[0], this.p.selrow = void 0 === h ? null : h), b("#jqg_" + b.jgrid.jqID(this.p.id) + "_" + b.jgrid.jqID(a.id))[this.p.useProp ? "prop" : "attr"]("checked", d), k && (-1 === g ? b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).addClass("ui-state-highlight") : b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(this.p.id) + "_" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k))[this.p.useProp ? "prop" : "attr"]("checked", d)), f && (b(this).triggerHandler("jqGridSelectRow", [a.id, d, c]), this.p.onSelectRow && this.p.onSelectRow.call(this, a.id, d, c))) : "ui-subgrid" !== a.className && (this.p.selrow !== a.id ? (b(b(this).jqGrid("getGridRowById", this.p.selrow)).removeClass("ui-state-highlight").attr({
"aria-selected": "false",
tabindex: "-1"
}), b(a).addClass("ui-state-highlight").attr({
"aria-selected": "true",
tabindex: "0"
}), k && (b("#" + b.jgrid.jqID(this.p.selrow), "#" + b.jgrid.jqID(k)).removeClass("ui-state-highlight"), b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).addClass("ui-state-highlight")), d = !0) : d = !1, this.p.selrow = a.id, f && (b(this).triggerHandler("jqGridSelectRow", [a.id, d, c]), this.p.onSelectRow && this.p.onSelectRow.call(this, a.id, d, c)))))
})
},
resetSelection: function (e) {
return this.each(function () {
var f = this,
c, d; !0 === f.p.frozenColumns && (d = f.p.id + "_frozen");
if (void 0 !== e) {
c = e === f.p.selrow ? f.p.selrow : e;
b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
d && b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight");
if (f.p.multiselect) {
b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(f.p.id))[f.p.useProp ? "prop" : "attr"]("checked", !1);
if (d) b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d))[f.p.useProp ? "prop" : "attr"]("checked", !1);
f.setHeadCheckBox(!1)
}
c = null
} else f.p.multiselect ? (b(f.p.selarrrow).each(function (a, c) {
b(b(f).jqGrid("getGridRowById", c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c))[f.p.useProp ? "prop" : "attr"]("checked", !1);
d && (b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d))[f.p.useProp ? "prop" : "attr"]("checked", !1))
}), f.setHeadCheckBox(!1), f.p.selarrrow = [], f.p.selrow = null) : f.p.selrow && (b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected", "false"), d && b("#" + b.jgrid.jqID(f.p.selrow), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight"), f.p.selrow = null); !0 === f.p.cellEdit && 0 <= parseInt(f.p.iCol, 10) && 0 <= parseInt(f.p.iRow, 10) && (b("td:eq(" + f.p.iCol + ")", f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"), b(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));
f.p.savedRow = []
})
},
getRowData: function (e) {
var f = {},
c, d = !1,
a, l = 0;
this.each(function () {
var g = this,
h, k;
if (void 0 === e) d = !0,
c = [],
a = g.rows.length;
else {
k = b(g).jqGrid("getGridRowById", e);
if (!k) return f;
a = 2
}
for (; l < a;) d && (k = g.rows[l]),
b(k).hasClass("jqgrow") && (b('td[role="gridcell"]', k).each(function (a) {
h = g.p.colModel[a].name;
if ("cb" !== h && "subgrid" !== h && "rn" !== h) if (!0 === g.p.treeGrid && h === g.p.ExpandColumn) f[h] = b.jgrid.htmlDecode(b("span:first", this).html());
else try {
f[h] = b.unformat.call(g, this, {
rowId: k.id,
colModel: g.p.colModel[a]
},
a)
} catch (c) {
f[h] = b.jgrid.htmlDecode(b(this).html())
}
}), d && (c.push(f), f = {})),
l++
});
return c || f
},
delRowData: function (e) {
var f = !1,
c, d;
this.each(function () {
c = b(this).jqGrid("getGridRowById", e);
if (!c) return !1;
b(c).remove();
this.p.records--;
this.p.reccount--;
this.updatepager(!0, !1);
f = !0;
this.p.multiselect && (d = b.inArray(e, this.p.selarrrow), -1 !== d && this.p.selarrrow.splice(d, 1));
this.p.selrow = this.p.multiselect && 0 < this.p.selarrrow.length ? this.p.selarrrow[this.p.selarrrow.length - 1] : null;
if ("local" === this.p.datatype) {
var a = b.jgrid.stripPref(this.p.idPrefix, e),
a = this.p._index[a];
void 0 !== a && (this.p.data.splice(a, 1), this.refreshIndex())
}
if (!0 === this.p.altRows && f) {
var l = this.p.altclass;
b(this.rows).each(function (a) {
1 === a % 2 ? b(this).addClass(l) : b(this).removeClass(l)
})
}
});
return f
},
setRowData: function (e, f, c) {
var d, a = !0,
l;
this.each(function () {
if (!this.grid) return !1;
var g = this,
h, k, n = typeof c,
m = {};
k = b(this).jqGrid("getGridRowById", e);
if (!k) return !1;
if (f) try {
if (b(this.p.colModel).each(function (a) {
d = this.name;
var c = b.jgrid.getAccessor(f, d);
void 0 !== c && (m[d] = this.formatter && "string" === typeof this.formatter && "date" === this.formatter ? b.unformat.date.call(g, c, this) : c, h = g.formatter(e, c, a, f, "edit"), l = this.title ? {
title: b.jgrid.stripHtml(h)
} : {},
!0 === g.p.treeGrid && d === g.p.ExpandColumn ? b("td[role='gridcell']:eq(" + a + ") > span:first", k).html(h).attr(l) : b("td[role='gridcell']:eq(" + a + ")", k).html(h).attr(l))
}), "local" === g.p.datatype) {
var r = b.jgrid.stripPref(g.p.idPrefix, e),
p = g.p._index[r],
q;
if (g.p.treeGrid) for (q in g.p.treeReader) g.p.treeReader.hasOwnProperty(q) && delete m[g.p.treeReader[q]];
void 0 !== p && (g.p.data[p] = b.extend(!0, g.p.data[p], m));
m = null
}
} catch (x) {
a = !1
}
a && ("string" === n ? b(k).addClass(c) : null !== c && "object" === n && b(k).css(c), b(g).triggerHandler("jqGridAfterGridComplete"))
});
return a
},
addRowData: function (e, f, c, d) {
c || (c = "last");
var a = !1,
l, g, h, k, n, m, r, p, q = "",
x, G, U, M, ea, W;
f && (b.isArray(f) ? (x = !0, c = "last", G = e) : (f = [f], x = !1), this.each(function () {
var X = f.length;
n = !0 === this.p.rownumbers ? 1 : 0;
h = !0 === this.p.multiselect ? 1 : 0;
k = !0 === this.p.subGrid ? 1 : 0;
x || (void 0 !== e ? e = String(e) : (e = b.jgrid.randId(), !1 !== this.p.keyIndex && (G = this.p.colModel[this.p.keyIndex + h + k + n].name, void 0 !== f[0][G] && (e = f[0][G]))));
U = this.p.altclass;
for (var O = 0,
$ = "",
K = {},
Y = b.isFunction(this.p.afterInsertRow) ? !0 : !1; O < X;) {
M = f[O];
g = [];
if (x) {
try {
e = M[G],
void 0 === e && (e = b.jgrid.randId())
} catch (oa) {
e = b.jgrid.randId()
}
$ = !0 === this.p.altRows ? 0 === (this.rows.length - 1) % 2 ? U : "" : ""
}
W = e;
e = this.p.idPrefix + e;
n && (q = this.formatCol(0, 1, "", null, e, !0), g[g.length] = '
0
");
h && (p = '', q = this.formatCol(n, 1, "", null, e, !0), g[g.length] = '
" + p + "
");
k && (g[g.length] = b(this).jqGrid("addSubGridCell", h + n, 1));
for (r = h + k + n; r < this.p.colModel.length; r++) ea = this.p.colModel[r],
l = ea.name,
K[l] = M[l],
p = this.formatter(e, b.jgrid.getAccessor(M, l), r, M),
q = this.formatCol(r, 1, p, M, e, K),
g[g.length] = '
" + p + "
";
g.unshift(this.constructTr(e, !1, $, K, M, !1));
g[g.length] = "";
if (0 === this.rows.length) b("table:first", this.grid.bDiv).append(g.join(""));
else switch (c) {
case "last":
b(this.rows[this.rows.length - 1]).after(g.join(""));
m = this.rows.length - 1;
break;
case "first":
b(this.rows[0]).after(g.join(""));
m = 1;
break;
case "after":
if (m = b(this).jqGrid("getGridRowById", d)) b(this.rows[m.rowIndex + 1]).hasClass("ui-subgrid") ? b(this.rows[m.rowIndex + 1]).after(g) : b(m).after(g.join("")),
m = m.rowIndex + 1;
break;
case "before":
if (m = b(this).jqGrid("getGridRowById", d)) b(m).before(g.join("")),
m = m.rowIndex - 1
} !0 === this.p.subGrid && b(this).jqGrid("addSubGrid", h + n, m);
this.p.records++;
this.p.reccount++;
b(this).triggerHandler("jqGridAfterInsertRow", [e, M, M]);
Y && this.p.afterInsertRow.call(this, e, M, M);
O++;
"local" === this.p.datatype && (K[this.p.localReader.id] = W, this.p._index[W] = this.p.data.length, this.p.data.push(K), K = {})
} !0 !== this.p.altRows || x || ("last" === c ? 1 === (this.rows.length - 1) % 2 && b(this.rows[this.rows.length - 1]).addClass(U) : b(this.rows).each(function (a) {
1 === a % 2 ? b(this).addClass(U) : b(this).removeClass(U)
}));
this.updatepager(!0, !0);
a = !0
}));
return a
},
footerData: function (e, f, c) {
function d(a) {
for (var b in a) if (a.hasOwnProperty(b)) return !1;
return !0
}
var a, l = !1,
g = {},
h;
void 0 == e && (e = "get");
"boolean" !== typeof c && (c = !0);
e = e.toLowerCase();
this.each(function () {
var k = this,
n;
if (!k.grid || !k.p.footerrow || "set" === e && d(f)) return !1;
l = !0;
b(this.p.colModel).each(function (d) {
a = this.name;
"set" === e ? void 0 !== f[a] && (n = c ? k.formatter("", f[a], d, f, "edit") : f[a], h = this.title ? {
title: b.jgrid.stripHtml(n)
} : {},
b("tr.footrow td:eq(" + d + ")", k.grid.sDiv).html(n).attr(h), l = !0) : "get" === e && (g[a] = b("tr.footrow td:eq(" + d + ")", k.grid.sDiv).html())
})
});
return "get" === e ? g : l
},
showHideCol: function (e, f) {
return this.each(function () {
var c = this,
d = !1,
a = b.jgrid.cell_width ? 0 : c.p.cellLayout,
l;
if (c.grid) {
"string" === typeof e && (e = [e]);
f = "none" !== f ? "" : "none";
var g = "" === f ? !0 : !1,
h = c.p.groupHeader && ("object" === typeof c.p.groupHeader || b.isFunction(c.p.groupHeader));
h && b(c).jqGrid("destroyGroupHeader", !1);
b(this.p.colModel).each(function (h) {
if (-1 !== b.inArray(this.name, e) && this.hidden === g) {
if (!0 === c.p.frozenColumns && !0 === this.frozen) return !0;
b("tr[role=rowheader]", c.grid.hDiv).each(function () {
b(this.cells[h]).css("display", f)
});
b(c.rows).each(function () {
b(this).hasClass("jqgroup") || b(this.cells[h]).css("display", f)
});
c.p.footerrow && b("tr.footrow td:eq(" + h + ")", c.grid.sDiv).css("display", f);
l = parseInt(this.width, 10);
c.p.tblwidth = "none" === f ? c.p.tblwidth - (l + a) : c.p.tblwidth + (l + a);
this.hidden = !g;
d = !0;
b(c).triggerHandler("jqGridShowHideCol", [g, this.name, h])
}
}); !0 === d && (!0 !== c.p.shrinkToFit || isNaN(c.p.height) || (c.p.tblwidth += parseInt(c.p.scrollOffset, 10)), b(c).jqGrid("setGridWidth", !0 === c.p.shrinkToFit ? c.p.tblwidth : c.p.width));
h && b(c).jqGrid("setGroupHeaders", c.p.groupHeader)
}
})
},
hideCol: function (e) {
return this.each(function () {
b(this).jqGrid("showHideCol", e, "none")
})
},
showCol: function (e) {
return this.each(function () {
b(this).jqGrid("showHideCol", e, "")
})
},
remapColumns: function (e, f, c) {
function d(a) {
var c;
c = a.length ? b.makeArray(a) : b.extend({},
a);
b.each(e,
function (b) {
a[b] = c[this]
})
}
function a(a, c) {
b(">tr" + (c || ""), a).each(function () {
var a = this,
c = b.makeArray(a.cells);
b.each(e,
function () {
var b = c[this];
b && a.appendChild(b)
})
})
}
var l = this.get(0);
d(l.p.colModel);
d(l.p.colNames);
d(l.grid.headers);
a(b("thead:first", l.grid.hDiv), c && ":not(.ui-jqgrid-labels)");
f && a(b("#" + b.jgrid.jqID(l.p.id) + " tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
l.p.footerrow && a(b("tbody:first", l.grid.sDiv));
l.p.remapColumns && (l.p.remapColumns.length ? d(l.p.remapColumns) : l.p.remapColumns = b.makeArray(e));
l.p.lastsort = b.inArray(l.p.lastsort, e);
l.p.treeGrid && (l.p.expColInd = b.inArray(l.p.expColInd, e));
b(l).triggerHandler("jqGridRemapColumns", [e, f, c])
},
setGridWidth: function (e, f) {
return this.each(function () {
if (this.grid) {
var c = this,
d, a = 0,
l = b.jgrid.cell_width ? 0 : c.p.cellLayout,
g,
h = 0,
k = !1,
n = c.p.scrollOffset,
m,
r = 0,
p;
"boolean" !== typeof f && (f = c.p.shrinkToFit);
if (!isNaN(e)) {
e = parseInt(e, 10);
c.grid.width = c.p.width = e;
b("#gbox_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
b("#gview_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
b(c.grid.bDiv).css("width", e + "px");
b(c.grid.hDiv).css("width", e + "px");
c.p.pager && b(c.p.pager).css("width", e + "px");
c.p.toppager && b(c.p.toppager).css("width", e + "px"); !0 === c.p.toolbar[0] && (b(c.grid.uDiv).css("width", e + "px"), "both" === c.p.toolbar[1] && b(c.grid.ubDiv).css("width", e + "px"));
c.p.footerrow && b(c.grid.sDiv).css("width", e + "px"); !1 === f && !0 === c.p.forceFit && (c.p.forceFit = !1);
if (!0 === f) {
b.each(c.p.colModel,
function () {
!1 === this.hidden && (d = this.widthOrg, a += d + l, this.fixed ? r += d + l : h++)
});
if (0 === h) return;
c.p.tblwidth = a;
m = e - l * h - r; !isNaN(c.p.height) && (b(c.grid.bDiv)[0].clientHeight < b(c.grid.bDiv)[0].scrollHeight || 1 === c.rows.length) && (k = !0, m -= n);
var a = 0,
q = 0 < c.grid.cols.length;
b.each(c.p.colModel,
function (b) {
!1 !== this.hidden || this.fixed || (d = this.widthOrg, d = Math.round(m * d / (c.p.tblwidth - l * h - r)), 0 > d || (this.width = d, a += d, c.grid.headers[b].width = d, c.grid.headers[b].el.style.width = d + "px", c.p.footerrow && (c.grid.footers[b].style.width = d + "px"), q && (c.grid.cols[b].style.width = d + "px"), g = b))
});
if (!g) return;
p = 0;
k ? e - r - (a + l * h) !== n && (p = e - r - (a + l * h) - n) : 1 !== Math.abs(e - r - (a + l * h)) && (p = e - r - (a + l * h));
c.p.colModel[g].width += p;
c.p.tblwidth = a + p + l * h + r;
c.p.tblwidth > e ? (k = c.p.tblwidth - parseInt(e, 10), c.p.tblwidth = e, d = c.p.colModel[g].width -= k) : d = c.p.colModel[g].width;
c.grid.headers[g].width = d;
c.grid.headers[g].el.style.width = d + "px";
q && (c.grid.cols[g].style.width = d + "px");
c.p.footerrow && (c.grid.footers[g].style.width = d + "px")
}
c.p.tblwidth && (b("table:first", c.grid.bDiv).css("width", c.p.tblwidth + "px"), b("table:first", c.grid.hDiv).css("width", c.p.tblwidth + "px"), c.grid.hDiv.scrollLeft = c.grid.bDiv.scrollLeft, c.p.footerrow && b("table:first", c.grid.sDiv).css("width", c.p.tblwidth + "px"))
}
}
})
},
setGridHeight: function (e) {
return this.each(function () {
if (this.grid) {
var f = b(this.grid.bDiv);
f.css({
height: e + (isNaN(e) ? "" : "px")
}); !0 === this.p.frozenColumns && b("#" + b.jgrid.jqID(this.p.id) + "_frozen").parent().height(f.height() - 16);
this.p.height = e;
this.p.scroll && this.grid.populateVisible()
}
})
},
setCaption: function (e) {
return this.each(function () {
this.p.caption = e;
b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl", this.grid.cDiv).html(e);
b(this.grid.cDiv).show()
})
},
setLabel: function (e, f, c, d) {
return this.each(function () {
var a = -1;
if (this.grid && void 0 !== e && (b(this.p.colModel).each(function (b) {
if (this.name === e) return a = b,
!1
}), 0 <= a)) {
var l = b("tr.ui-jqgrid-labels th:eq(" + a + ")", this.grid.hDiv);
if (f) {
var g = b(".s-ico", l);
b("[id^=jqgh_]", l).empty().html(f).append(g);
this.p.colNames[a] = f
}
c && ("string" === typeof c ? b(l).addClass(c) : b(l).css(c));
"object" === typeof d && b(l).attr(d)
}
})
},
setCell: function (e, f, c, d, a, l) {
return this.each(function () {
var g = -1,
h, k;
if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
if (this.name === f) return g = a,
!1
}) : g = parseInt(f, 10), 0 <= g && (h = b(this).jqGrid("getGridRowById", e)))) {
var n = b("td:eq(" + g + ")", h);
if ("" !== c || !0 === l) h = this.formatter(e, c, g, h, "edit"),
k = this.p.colModel[g].title ? {
title: b.jgrid.stripHtml(h)
} : {},
this.p.treeGrid && 0 < b(".tree-wrap", b(n)).length ? b("span", b(n)).html(h).attr(k) : b(n).html(h).attr(k),
"local" === this.p.datatype && (h = this.p.colModel[g], c = h.formatter && "string" === typeof h.formatter && "date" === h.formatter ? b.unformat.date.call(this, c, h) : c, k = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], void 0 !== k && (this.p.data[k][h.name] = c));
"string" === typeof d ? b(n).addClass(d) : d && b(n).css(d);
"object" === typeof a && b(n).attr(a)
}
})
},
getCell: function (e, f) {
var c = !1;
this.each(function () {
var d = -1;
if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
if (this.name === f) return d = a,
!1
}) : d = parseInt(f, 10), 0 <= d)) {
var a = b(this).jqGrid("getGridRowById", e);
if (a) try {
c = b.unformat.call(this, b("td:eq(" + d + ")", a), {
rowId: a.id,
colModel: this.p.colModel[d]
},
d)
} catch (l) {
c = b.jgrid.htmlDecode(b("td:eq(" + d + ")", a).html())
}
}
});
return c
},
getCol: function (e, f, c) {
var d = [],
a,
l = 0,
g,
h,
k;
f = "boolean" !== typeof f ? !1 : f;
void 0 === c && (c = !1);
this.each(function () {
var n = -1;
if (this.grid && (isNaN(e) ? b(this.p.colModel).each(function (a) {
if (this.name === e) return n = a,
!1
}) : n = parseInt(e, 10), 0 <= n)) {
var m = this.rows.length,
r = 0,
p = 0;
if (m && 0 < m) {
for (; r < m;) {
if (b(this.rows[r]).hasClass("jqgrow")) {
try {
a = b.unformat.call(this, b(this.rows[r].cells[n]), {
rowId: this.rows[r].id,
colModel: this.p.colModel[n]
},
n)
} catch (q) {
a = b.jgrid.htmlDecode(this.rows[r].cells[n].innerHTML)
}
c ? (k = parseFloat(a), isNaN(k) || (l += k, void 0 === h && (h = g = k), g = Math.min(g, k), h = Math.max(h, k), p++)) : f ? d.push({
id: this.rows[r].id,
value: a
}) : d.push(a)
}
r++
}
if (c) switch (c.toLowerCase()) {
case "sum":
d = l;
break;
case "avg":
d = l / p;
break;
case "count":
d = m - 1;
break;
case "min":
d = g;
break;
case "max":
d = h
}
}
}
});
return d
},
clearGridData: function (e) {
return this.each(function () {
if (this.grid) {
"boolean" !== typeof e && (e = !1);
if (this.p.deepempty) b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:gt(0)").remove();
else {
var f = b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:first")[0];
b("#" + b.jgrid.jqID(this.p.id) + " tbody:first").empty().append(f)
}
this.p.footerrow && e && b(".ui-jqgrid-ftable td", this.grid.sDiv).html(" ");
this.p.selrow = null;
this.p.selarrrow = [];
this.p.savedRow = [];
this.p.records = 0;
this.p.page = 1;
this.p.lastpage = 0;
this.p.reccount = 0;
this.p.data = [];
this.p._index = {};
this.updatepager(!0, !1)
}
})
},
getInd: function (e, f) {
var c = !1,
d;
this.each(function () {
(d = b(this).jqGrid("getGridRowById", e)) && (c = !0 === f ? d : d.rowIndex)
});
return c
},
bindKeys: function (e) {
var f = b.extend({
onEnter: null,
onSpace: null,
onLeftKey: null,
onRightKey: null,
scrollingRows: !0
},
e || {});
return this.each(function () {
var c = this;
b("body").is("[role]") || b("body").attr("role", "application");
c.p.scrollrows = f.scrollingRows;
b(c).keydown(function (d) {
var a = b(c).find("tr[tabindex=0]")[0],
e,
g,
h,
k = c.p.treeReader.expanded_field;
if (a) if (h = c.p._index[b.jgrid.stripPref(c.p.idPrefix, a.id)], 37 === d.keyCode || 38 === d.keyCode || 39 === d.keyCode || 40 === d.keyCode) {
if (38 === d.keyCode) {
g = a.previousSibling;
e = "";
if (g) if (b(g).is(":hidden")) for (; g;) {
if (g = g.previousSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
e = g.id;
break
}
} else e = g.id;
b(c).jqGrid("setSelection", e, !0, d);
d.preventDefault()
}
if (40 === d.keyCode) {
g = a.nextSibling;
e = "";
if (g) if (b(g).is(":hidden")) for (; g;) {
if (g = g.nextSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
e = g.id;
break
}
} else e = g.id;
b(c).jqGrid("setSelection", e, !0, d);
d.preventDefault()
}
37 === d.keyCode && (c.p.treeGrid && c.p.data[h][k] && b(a).find("div.treeclick").trigger("click"), b(c).triggerHandler("jqGridKeyLeft", [c.p.selrow]), b.isFunction(f.onLeftKey) && f.onLeftKey.call(c, c.p.selrow));
39 === d.keyCode && (c.p.treeGrid && !c.p.data[h][k] && b(a).find("div.treeclick").trigger("click"), b(c).triggerHandler("jqGridKeyRight", [c.p.selrow]), b.isFunction(f.onRightKey) && f.onRightKey.call(c, c.p.selrow))
} else 13 === d.keyCode ? (b(c).triggerHandler("jqGridKeyEnter", [c.p.selrow]), b.isFunction(f.onEnter) && f.onEnter.call(c, c.p.selrow)) : 32 === d.keyCode && (b(c).triggerHandler("jqGridKeySpace", [c.p.selrow]), b.isFunction(f.onSpace) && f.onSpace.call(c, c.p.selrow))
})
})
},
unbindKeys: function () {
return this.each(function () {
b(this).unbind("keydown")
})
},
getLocalRow: function (e) {
var f = !1,
c;
this.each(function () {
void 0 !== e && (c = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], 0 <= c && (f = this.p.data[c]))
});
return f
}
})
})(jQuery); (function (a) {
a.fmatter = {};
a.extend(a.fmatter, {
isBoolean: function (a) {
return "boolean" === typeof a
},
isObject: function (c) {
return c && ("object" === typeof c || a.isFunction(c)) || !1
},
isString: function (a) {
return "string" === typeof a
},
isNumber: function (a) {
return "number" === typeof a && isFinite(a)
},
isValue: function (a) {
return this.isObject(a) || this.isString(a) || this.isNumber(a) || this.isBoolean(a)
},
isEmpty: function (c) {
if (!this.isString(c) && this.isValue(c)) return !1;
if (!this.isValue(c)) return !0;
c = a.trim(c).replace(/\ \;/ig, "").replace(/\ \;/ig, "");
return "" === c
}
});
a.fn.fmatter = function (c, b, d, e, f) {
var g = b;
d = a.extend({},
a.jgrid.formatter, d);
try {
g = a.fn.fmatter[c].call(this, b, d, e, f)
} catch (h) { }
return g
};
a.fmatter.util = {
NumberFormat: function (c, b) {
a.fmatter.isNumber(c) || (c *= 1);
if (a.fmatter.isNumber(c)) {
var d = 0 > c,
e = String(c),
f = b.decimalSeparator || ".",
g;
if (a.fmatter.isNumber(b.decimalPlaces)) {
var h = b.decimalPlaces,
e = Math.pow(10, h),
e = String(Math.round(c * e) / e);
g = e.lastIndexOf(".");
if (0 < h) for (0 > g ? (e += f, g = e.length - 1) : "." !== f && (e = e.replace(".", f)) ; e.length - 1 - g < h;) e += "0"
}
if (b.thousandsSeparator) {
h = b.thousandsSeparator;
g = e.lastIndexOf(f);
g = -1 < g ? g : e.length;
var f = e.substring(g),
l = -1,
k;
for (k = g; 0 < k; k--) l++,
0 === l % 3 && k !== g && (!d || 1 < k) && (f = h + f),
f = e.charAt(k - 1) + f;
e = f
}
e = b.prefix ? b.prefix + e : e;
return e = b.suffix ? e + b.suffix : e
}
return c
}
};
a.fn.fmatter.defaultFormat = function (c, b) {
return a.fmatter.isValue(c) && "" !== c ? c : b.defaultValue || " "
};
a.fn.fmatter.email = function (c, b) {
return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : '' + c + ""
};
a.fn.fmatter.checkbox = function (c, b) {
var d = a.extend({},
b.checkbox),
e;
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
e = !0 === d.disabled ? 'disabled="disabled"' : "";
if (a.fmatter.isEmpty(c) || void 0 === c) c = a.fn.fmatter.defaultFormat(c, d);
c = String(c);
c = (c + "").toLowerCase();
return ' c.search(/(false|f|0|no|n|off|undefined)/i) ? " checked='checked' " : "") + ' value="' + c + '" offval="no" ' + e + "/>"
};
a.fn.fmatter.link = function (c, b) {
var d = {
target: b.target
},
e = "";
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
d.target && (e = "target=" + d.target);
return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : "' + c + ""
};
a.fn.fmatter.showlink = function (c, b) {
var d = {
baseLinkUrl: b.baseLinkUrl,
showAction: b.showAction,
addParam: b.addParam || "",
target: b.target,
idName: b.idName
},
e = "";
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
d.target && (e = "target=" + d.target);
d = d.baseLinkUrl + d.showAction + "?" + d.idName + "=" + b.rowId + d.addParam;
return a.fmatter.isString(c) || a.fmatter.isNumber(c) ? "' + c + "" : a.fn.fmatter.defaultFormat(c, b)
};
a.fn.fmatter.integer = function (c, b) {
var d = a.extend({},
b.integer);
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
};
a.fn.fmatter.number = function (c, b) {
var d = a.extend({},
b.number);
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
};
a.fn.fmatter.currency = function (c, b) {
var d = a.extend({},
b.currency);
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
};
a.fn.fmatter.date = function (c, b, d, e) {
d = a.extend({},
b.date);
void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
d, b.colModel.formatoptions));
return d.reformatAfterEdit || "edit" !== e ? a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.srcformat, c, d.newformat, d) : a.fn.fmatter.defaultFormat(c, b)
};
a.fn.fmatter.select = function (c, b) {
c = String(c);
var d = !1,
e = [],
f,
g;
void 0 !== b.colModel.formatoptions ? (d = b.colModel.formatoptions.value, f = void 0 === b.colModel.formatoptions.separator ? ":" : b.colModel.formatoptions.separator, g = void 0 === b.colModel.formatoptions.delimiter ? ";" : b.colModel.formatoptions.delimiter) : void 0 !== b.colModel.editoptions && (d = b.colModel.editoptions.value, f = void 0 === b.colModel.editoptions.separator ? ":" : b.colModel.editoptions.separator, g = void 0 === b.colModel.editoptions.delimiter ? ";" : b.colModel.editoptions.delimiter);
if (d) {
var h = !0 === b.colModel.editoptions.multiple ? !0 : !1,
l = [];
h && (l = c.split(","), l = a.map(l,
function (b) {
return a.trim(b)
}));
if (a.fmatter.isString(d)) {
var k = d.split(g),
m = 0,
n;
for (n = 0; n < k.length; n++) if (g = k[n].split(f), 2 < g.length && (g[1] = a.map(g,
function (a, b) {
if (0 < b) return a
}).join(f)), h) -1 < a.inArray(g[0], l) && (e[m] = g[1], m++);
else if (a.trim(g[0]) === a.trim(c)) {
e[0] = g[1];
break
}
} else a.fmatter.isObject(d) && (h ? e = a.map(l,
function (a) {
return d[a]
}) : e[0] = d[c] || "")
}
c = e.join(", ");
return "" === c ? a.fn.fmatter.defaultFormat(c, b) : c
};
a.fn.fmatter.rowactions = function (c) {
var b = a(this).closest("tr.jqgrow"),
d = b.attr("id"),
e = a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/, "$1"),
e = a("#" + e),
f = e[0],
g = f.p,
h = g.colModel[a.jgrid.getCellIndex(this)],
l = h.frozen ? a("tr#" + d + " td:eq(" + a.jgrid.getCellIndex(this) + ") > div", e) : a(this).parent(),
k = {
extraparam: {}
},
m = function (b) {
a.isFunction(k.afterRestore) && k.afterRestore.call(f, b);
l.find("div.ui-inline-edit,div.ui-inline-del").show();
l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
};
void 0 !== h.formatoptions && (k = a.extend(k, h.formatoptions));
void 0 !== g.editOptions && (k.editOptions = g.editOptions);
void 0 !== g.delOptions && (k.delOptions = g.delOptions);
b.hasClass("jqgrid-new-row") && (k.extraparam[g.prmNames.oper] = g.prmNames.addoper);
b = {
keys: k.keys,
oneditfunc: k.onEdit,
successfunc: k.onSuccess,
url: k.url,
extraparam: k.extraparam,
aftersavefunc: function (b, c) {
a.isFunction(k.afterSave) && k.afterSave.call(f, b, c);
l.find("div.ui-inline-edit,div.ui-inline-del").show();
l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
},
errorfunc: k.onError,
afterrestorefunc: m,
restoreAfterError: k.restoreAfterError,
mtype: k.mtype
};
switch (c) {
case "edit":
e.jqGrid("editRow", d, b);
l.find("div.ui-inline-edit,div.ui-inline-del").hide();
l.find("div.ui-inline-save,div.ui-inline-cancel").show();
e.triggerHandler("jqGridAfterGridComplete");
break;
case "save":
e.jqGrid("saveRow", d, b) && (l.find("div.ui-inline-edit,div.ui-inline-del").show(), l.find("div.ui-inline-save,div.ui-inline-cancel").hide(), e.triggerHandler("jqGridAfterGridComplete"));
break;
case "cancel":
e.jqGrid("restoreRow", d, m);
l.find("div.ui-inline-edit,div.ui-inline-del").show();
l.find("div.ui-inline-save,div.ui-inline-cancel").hide();
e.triggerHandler("jqGridAfterGridComplete");
break;
case "del":
e.jqGrid("delGridRow", d, k.delOptions);
break;
case "formedit":
e.jqGrid("setSelection", d),
e.jqGrid("editGridRow", d, k.editOptions)
}
};
a.fn.fmatter.actions = function (c, b) {
var d = {
keys: !1,
editbutton: !0,
delbutton: !0,
editformbutton: !1
},
e = b.rowId,
f = "";
void 0 !== b.colModel.formatoptions && (d = a.extend(d, b.colModel.formatoptions));
if (void 0 === e || a.fmatter.isEmpty(e)) return "";
d.editformbutton ? f += "
" : d.editbutton && (f += "
");
d.delbutton && (f += "
");
f += "
";
f += "
";
return "
" + f + "
"
};
a.unformat = function (c, b, d, e) {
var f, g = b.colModel.formatter,
h = b.colModel.formatoptions || {},
l = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
k = b.colModel.unformat || a.fn.fmatter[g] && a.fn.fmatter[g].unformat;
if (void 0 !== k && a.isFunction(k)) f = k.call(this, a(c).text(), b, c);
else if (void 0 !== g && a.fmatter.isString(g)) switch (f = a.jgrid.formatter || {},
g) {
case "integer":
h = a.extend({},
f.integer, h);
b = h.thousandsSeparator.replace(l, "\\$1");
b = RegExp(b, "g");
f = a(c).text().replace(b, "");
break;
case "number":
h = a.extend({},
f.number, h);
b = h.thousandsSeparator.replace(l, "\\$1");
b = RegExp(b, "g");
f = a(c).text().replace(b, "").replace(h.decimalSeparator, ".");
break;
case "currency":
h = a.extend({},
f.currency, h);
b = h.thousandsSeparator.replace(l, "\\$1");
b = RegExp(b, "g");
f = a(c).text();
h.prefix && h.prefix.length && (f = f.substr(h.prefix.length));
h.suffix && h.suffix.length && (f = f.substr(0, f.length - h.suffix.length));
f = f.replace(b, "").replace(h.decimalSeparator, ".");
break;
case "checkbox":
h = b.colModel.editoptions ? b.colModel.editoptions.value.split(":") : ["Yes", "No"];
f = a("input", c).is(":checked") ? h[0] : h[1];
break;
case "select":
f = a.unformat.select(c, b, d, e);
break;
case "actions":
return "";
default:
f = a(c).text()
}
return void 0 !== f ? f : !0 === e ? a(c).text() : a.jgrid.htmlDecode(a(c).html())
};
a.unformat.select = function (c, b, d, e) {
d = [];
c = a(c).text();
if (!0 === e) return c;
e = a.extend({},
void 0 !== b.colModel.formatoptions ? b.colModel.formatoptions : b.colModel.editoptions);
b = void 0 === e.separator ? ":" : e.separator;
var f = void 0 === e.delimiter ? ";" : e.delimiter;
if (e.value) {
var g = e.value;
e = !0 === e.multiple ? !0 : !1;
var h = [];
e && (h = c.split(","), h = a.map(h,
function (b) {
return a.trim(b)
}));
if (a.fmatter.isString(g)) {
var l = g.split(f),
k = 0,
m;
for (m = 0; m < l.length; m++) if (f = l[m].split(b), 2 < f.length && (f[1] = a.map(f,
function (a, b) {
if (0 < b) return a
}).join(b)), e) -1 < a.inArray(f[1], h) && (d[k] = f[0], k++);
else if (a.trim(f[1]) === a.trim(c)) {
d[0] = f[0];
break
}
} else if (a.fmatter.isObject(g) || a.isArray(g)) e || (h[0] = c),
d = a.map(h,
function (b) {
var c;
a.each(g,
function (a, d) {
if (d === b) return c = a,
!1
});
if (void 0 !== c) return c
});
return d.join(", ")
}
return c || ""
};
a.unformat.date = function (c, b) {
var d = a.jgrid.formatter.date || {};
void 0 !== b.formatoptions && (d = a.extend({},
d, b.formatoptions));
return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.newformat, c, d.srcformat, d)
}
})(jQuery); (function (a) {
a.jgrid.extend({
getColProp: function (a) {
var c = {},
d = this[0];
if (!d.grid) return !1;
var d = d.p.colModel,
h;
for (h = 0; h < d.length; h++) if (d[h].name === a) {
c = d[h];
break
}
return c
},
setColProp: function (b, c) {
return this.each(function () {
if (this.grid && c) {
var d = this.p.colModel,
h;
for (h = 0; h < d.length; h++) if (d[h].name === b) {
a.extend(!0, this.p.colModel[h], c);
break
}
}
})
},
sortGrid: function (a, c, d) {
return this.each(function () {
var h = -1,
k, e = !1;
if (this.grid) {
a || (a = this.p.sortname);
for (k = 0; k < this.p.colModel.length; k++) if (this.p.colModel[k].index === a || this.p.colModel[k].name === a) {
h = k; !0 === this.p.frozenColumns && !0 === this.p.colModel[k].frozen && (e = this.grid.fhDiv.find("#" + this.p.id + "_" + a));
break
} -1 !== h && (k = this.p.colModel[h].sortable, e || (e = this.grid.headers[h].el), "boolean" !== typeof k && (k = !0), "boolean" !== typeof c && (c = !1), k && this.sortData("jqgh_" + this.p.id + "_" + a, h, c, d, e))
}
})
},
clearBeforeUnload: function () {
return this.each(function () {
var b = this.grid;
a.isFunction(b.emptyRows) && b.emptyRows.call(this, !0, !0);
a(document).unbind("mouseup.jqGrid" + this.p.id);
a(b.hDiv).unbind("mousemove");
a(this).unbind();
b.dragEnd = null;
b.dragMove = null;
b.dragStart = null;
b.emptyRows = null;
b.populate = null;
b.populateVisible = null;
b.scrollGrid = null;
b.selectionPreserver = null;
b.bDiv = null;
b.cDiv = null;
b.hDiv = null;
b.cols = null;
var c, d = b.headers.length;
for (c = 0; c < d; c++) b.headers[c].el = null;
this.grid = this.addJSONData = this.addXmlData = this.formatter = this.constructTr = this.setHeadCheckBox = this.refreshIndex = this.updatepager = this.sortData = this.formatCol = null
})
},
GridDestroy: function () {
return this.each(function () {
if (this.grid) {
this.p.pager && a(this.p.pager).remove();
try {
a(this).jqGrid("clearBeforeUnload"),
a("#gbox_" + a.jgrid.jqID(this.id)).remove()
} catch (b) { }
}
})
},
GridUnload: function () {
return this.each(function () {
if (this.grid) {
var b = a(this).attr("id"),
c = a(this).attr("class");
this.p.pager && a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");
var d = document.createElement("table");
a(d).attr({
id: b
});
d.className = c;
b = a.jgrid.jqID(this.id);
a(d).removeClass("ui-jqgrid-btable");
1 === a(this.p.pager).parents("#gbox_" + b).length ? (a(d).insertBefore("#gbox_" + b).show(), a(this.p.pager).insertBefore("#gbox_" + b)) : a(d).insertBefore("#gbox_" + b).show();
a(this).jqGrid("clearBeforeUnload");
a("#gbox_" + b).remove()
}
})
},
setGridState: function (b) {
return this.each(function () {
this.grid && ("hidden" === b ? (a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv", "#gview_" + a.jgrid.jqID(this.p.id)).slideUp("fast"), this.p.pager && a(this.p.pager).slideUp("fast"), this.p.toppager && a(this.p.toppager).slideUp("fast"), !0 === this.p.toolbar[0] && ("both" === this.p.toolbar[1] && a(this.grid.ubDiv).slideUp("fast"), a(this.grid.uDiv).slideUp("fast")), this.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + a.jgrid.jqID(this.p.id)).slideUp("fast"), a(".ui-jqgrid-titlebar-close span", this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"), this.p.gridstate = "hidden") : "visible" === b && (a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv", "#gview_" + a.jgrid.jqID(this.p.id)).slideDown("fast"), this.p.pager && a(this.p.pager).slideDown("fast"), this.p.toppager && a(this.p.toppager).slideDown("fast"), !0 === this.p.toolbar[0] && ("both" === this.p.toolbar[1] && a(this.grid.ubDiv).slideDown("fast"), a(this.grid.uDiv).slideDown("fast")), this.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + a.jgrid.jqID(this.p.id)).slideDown("fast"), a(".ui-jqgrid-titlebar-close span", this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"), this.p.gridstate = "visible"))
})
},
filterToolbar: function (b) {
b = a.extend({
autosearch: !0,
searchOnEnter: !0,
beforeSearch: null,
afterSearch: null,
beforeClear: null,
afterClear: null,
searchurl: "",
stringResult: !1,
groupOp: "AND",
defaultSearch: "bw",
searchOperators: !1,
resetIcon: "x",
operands: {
eq: "==",
ne: "!",
lt: "<",
le: "<=",
gt: ">",
ge: ">=",
bw: "^",
bn: "!^",
"in": "=",
ni: "!=",
ew: "|",
en: "!@",
cn: "~",
nc: "!~",
nu: "#",
nn: "!#"
}
},
a.jgrid.search, b || {});
return this.each(function () {
var c = this;
if (!this.ftoolbar) {
var d = function () {
var d = {},
f = 0,
g, m, e = {},
q;
a.each(c.p.colModel,
function () {
var l = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
m = this.index || this.name;
q = b.searchOperators ? l.parent().prev().children("a").attr("soper") || b.defaultSearch : this.searchoptions && this.searchoptions.sopt ? this.searchoptions.sopt[0] : "select" === this.stype ? "eq" : b.defaultSearch;
if ((g = "custom" === this.stype && a.isFunction(this.searchoptions.custom_value) && 0 < l.length && "SPAN" === l[0].nodeName.toUpperCase() ? this.searchoptions.custom_value.call(c, l.children(".customelement:first"), "get") : l.val()) || "nu" === q || "nn" === q) d[m] = g,
e[m] = q,
f++;
else try {
delete c.p.postData[m]
} catch (k) { }
});
var k = 0 < f ? !0 : !1;
if (!0 === b.stringResult || "local" === c.p.datatype) {
var l = '{"groupOp":"' + b.groupOp + '","rules":[',
n = 0;
a.each(d,
function (a, b) {
0 < n && (l += ",");
l += '{"field":"' + a + '",';
l += '"op":"' + e[a] + '",';
l += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
n++
});
l += "]}";
a.extend(c.p.postData, {
filters: l
});
a.each(["searchField", "searchString", "searchOper"],
function (a, b) {
c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
})
} else a.extend(c.p.postData, d);
var r;
c.p.searchurl && (r = c.p.url, a(c).jqGrid("setGridParam", {
url: c.p.searchurl
}));
var h = "stop" === a(c).triggerHandler("jqGridToolbarBeforeSearch") ? !0 : !1; !h && a.isFunction(b.beforeSearch) && (h = b.beforeSearch.call(c));
h || a(c).jqGrid("setGridParam", {
search: k
}).trigger("reloadGrid", [{
page: 1
}]);
r && a(c).jqGrid("setGridParam", {
url: r
});
a(c).triggerHandler("jqGridToolbarAfterSearch");
a.isFunction(b.afterSearch) && b.afterSearch.call(c)
},
h = function (e, f, g) {
a("#sopt_menu").remove();
f = parseInt(f, 10);
g = parseInt(g, 10) + 18;
f = '
';
g = a(e).attr("soper");
var k, h = [],
q,
p = 0,
l = a(e).attr("colname");
for (k = c.p.colModel.length; p < k && c.p.colModel[p].name !== l;) p++;
p = c.p.colModel[p];
l = a.extend({},
p.searchoptions);
l.sopt || (l.sopt = [], l.sopt[0] = "select" === p.stype ? "eq" : b.defaultSearch);
a.each(b.odata,
function () {
h.push(this.oper)
});
for (p = 0; p < l.sopt.length; p++) q = a.inArray(l.sopt[p], h),
-1 !== q && (k = g === b.odata[q].oper ? "ui-state-highlight" : "", f += '
' + b.operands[b.odata[q].oper] + "
" + b.odata[q].text + "
");
f += "
";
a("body").append(f);
a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
a("#sopt_menu > li > a").hover(function () {
a(this).addClass("ui-state-hover")
},
function () {
a(this).removeClass("ui-state-hover")
}).click(function (f) {
f = a(this).attr("value");
var g = a(this).attr("oper");
a(c).triggerHandler("jqGridToolbarSelectOper", [f, g, e]);
a("#sopt_menu").hide();
a(e).text(g).attr("soper", f); !0 === b.autosearch && (g = a(e).parent().next().children()[0], (a(g).val() || "nu" === f || "nn" === f) && d())
})
},
k = a("
"),
e;
a.each(c.p.colModel,
function (h) {
var f = this,
g, m;
m = "";
var x = "=",
q, p = a("
"),
l = a(""),
n = a("
"); !0 === this.hidden && a(p).css("display", "none");
this.search = !1 === this.search ? !1 : !0;
void 0 === this.stype && (this.stype = "text");
g = a.extend({},
this.searchoptions || {});
if (this.search) {
if (b.searchOperators) {
m = g.sopt ? g.sopt[0] : "select" === f.stype ? "eq" : b.defaultSearch;
for (q = 0; q < b.odata.length; q++) if (b.odata[q].oper === m) {
x = b.operands[m] || "";
break
}
m = "" + x + ""
}
a("td:eq(0)", n).attr("colindex", h).append(m);
void 0 === g.clearSearch && (g.clearSearch = !0);
g.clearSearch ? (m = b.resetTitle || "Clear Search Value", a("td:eq(2)", n).append("" + b.resetIcon + "")) : a("td:eq(2)", n).hide();
switch (this.stype) {
case "select":
if (m = this.surl || g.dataUrl) a(l).append(n),
a.ajax(a.extend({
url: m,
dataType: "html",
success: function (e) {
void 0 !== g.buildSelect ? (e = g.buildSelect(e)) && a("td:eq(1)", n).append(e) : a("td:eq(1)", n).append(e);
void 0 !== g.defaultValue && a("select", l).val(g.defaultValue);
a("select", l).attr({
name: f.index || f.name,
id: "gs_" + f.name
});
g.attr && a("select", l).attr(g.attr);
a("select", l).css({
width: "100%"
});
a.jgrid.bindEv.call(c, a("select", l)[0], g); !0 === b.autosearch && a("select", l).change(function () {
d();
return !1
});
e = null
}
},
a.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
else {
var r, w, u;
f.searchoptions ? (r = void 0 === f.searchoptions.value ? "" : f.searchoptions.value, w = void 0 === f.searchoptions.separator ? ":" : f.searchoptions.separator, u = void 0 === f.searchoptions.delimiter ? ";" : f.searchoptions.delimiter) : f.editoptions && (r = void 0 === f.editoptions.value ? "" : f.editoptions.value, w = void 0 === f.editoptions.separator ? ":" : f.editoptions.separator, u = void 0 === f.editoptions.delimiter ? ";" : f.editoptions.delimiter);
if (r) {
var t = document.createElement("select");
t.style.width = "100%";
a(t).attr({
name: f.index || f.name,
id: "gs_" + f.name
});
var v;
if ("string" === typeof r) for (m = r.split(u), v = 0; v < m.length; v++) r = m[v].split(w),
u = document.createElement("option"),
u.value = r[0],
u.innerHTML = r[1],
t.appendChild(u);
else if ("object" === typeof r) for (v in r) r.hasOwnProperty(v) && (u = document.createElement("option"), u.value = v, u.innerHTML = r[v], t.appendChild(u));
void 0 !== g.defaultValue && a(t).val(g.defaultValue);
g.attr && a(t).attr(g.attr);
a(l).append(n);
a.jgrid.bindEv.call(c, t, g);
a("td:eq(1)", n).append(t); !0 === b.autosearch && a(t).change(function () {
d();
return !1
})
}
}
break;
case "text":
w = void 0 !== g.defaultValue ? g.defaultValue : "";
a("td:eq(1)", n).append("");
a(l).append(n);
g.attr && a("input", l).attr(g.attr);
a.jgrid.bindEv.call(c, a("input", l)[0], g); !0 === b.autosearch && (b.searchOnEnter ? a("input", l).keypress(function (a) {
return 13 === (a.charCode || a.keyCode || 0) ? (d(), !1) : this
}) : a("input", l).keydown(function (a) {
switch (a.which) {
case 13:
return !1;
case 9:
case 16:
case 37:
case 38:
case 39:
case 40:
case 27:
break;
default:
e && clearTimeout(e),
e = setTimeout(function () {
d()
},
500)
}
}));
break;
case "custom":
a("td:eq(1)", n).append("");
a(l).append(n);
try {
if (a.isFunction(g.custom_element)) if (t = g.custom_element.call(c, void 0 !== g.defaultValue ? g.defaultValue : "", g)) t = a(t).addClass("customelement"),
a(l).find(">span").append(t);
else throw "e2";
else throw "e1";
} catch (y) {
"e1" === y && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
"e2" === y ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.novalue, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, "string" === typeof y ? y : y.message, a.jgrid.edit.bClose)
}
}
}
a(p).append(l);
a(k).append(p);
b.searchOperators || a("td:eq(0)", n).hide()
});
a("table thead", c.grid.hDiv).append(k);
b.searchOperators && (a(".soptclass", k).click(function (b) {
var c = a(this).offset();
h(this, c.left, c.top);
b.stopPropagation()
}), a("body").on("click",
function (b) {
"soptclass" !== b.target.className && a("#sopt_menu").hide()
}));
a(".clearsearchclass", k).click(function (e) {
e = a(this).parents("tr:first");
var f = parseInt(a("td.ui-search-oper", e).attr("colindex"), 10),
g = a.extend({},
c.p.colModel[f].searchoptions || {}),
g = g.defaultValue ? g.defaultValue : "";
"select" === c.p.colModel[f].stype ? g ? a("td.ui-search-input select", e).val(g) : a("td.ui-search-input select", e)[0].selectedIndex = 0 : a("td.ui-search-input input", e).val(g); !0 === b.autosearch && d()
});
this.ftoolbar = !0;
this.triggerToolbar = d;
this.clearToolbar = function (d) {
var f = {},
g = 0,
e;
d = "boolean" !== typeof d ? !0 : d;
a.each(c.p.colModel,
function () {
var b, d = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
this.searchoptions && void 0 !== this.searchoptions.defaultValue && (b = this.searchoptions.defaultValue);
e = this.index || this.name;
switch (this.stype) {
case "select":
d.find("option").each(function (c) {
0 === c && (this.selected = !0);
if (a(this).val() === b) return this.selected = !0,
!1
});
if (void 0 !== b) f[e] = b,
g++;
else try {
delete c.p.postData[e]
} catch (h) { }
break;
case "text":
d.val(b || "");
if (void 0 !== b) f[e] = b,
g++;
else try {
delete c.p.postData[e]
} catch (k) { }
break;
case "custom":
a.isFunction(this.searchoptions.custom_value) && 0 < d.length && "SPAN" === d[0].nodeName.toUpperCase() && this.searchoptions.custom_value.call(c, d.children(".customelement:first"), "set", b || "")
}
});
var k = 0 < g ? !0 : !1;
c.p.resetsearch = !0;
if (!0 === b.stringResult || "local" === c.p.datatype) {
var h = '{"groupOp":"' + b.groupOp + '","rules":[',
p = 0;
a.each(f,
function (a, b) {
0 < p && (h += ",");
h += '{"field":"' + a + '",';
h += '"op":"eq",';
h += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
p++
});
h += "]}";
a.extend(c.p.postData, {
filters: h
});
a.each(["searchField", "searchString", "searchOper"],
function (a, b) {
c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
})
} else a.extend(c.p.postData, f);
var l;
c.p.searchurl && (l = c.p.url, a(c).jqGrid("setGridParam", {
url: c.p.searchurl
}));
var n = "stop" === a(c).triggerHandler("jqGridToolbarBeforeClear") ? !0 : !1; !n && a.isFunction(b.beforeClear) && (n = b.beforeClear.call(c));
n || d && a(c).jqGrid("setGridParam", {
search: k
}).trigger("reloadGrid", [{
page: 1
}]);
l && a(c).jqGrid("setGridParam", {
url: l
});
a(c).triggerHandler("jqGridToolbarAfterClear");
a.isFunction(b.afterClear) && b.afterClear()
};
this.toggleToolbar = function () {
var b = a("tr.ui-search-toolbar", c.grid.hDiv),
d = !0 === c.p.frozenColumns ? a("tr.ui-search-toolbar", c.grid.fhDiv) : !1;
"none" === b.css("display") ? (b.show(), d && d.show()) : (b.hide(), d && d.hide())
}
}
})
},
destroyFilterToolbar: function () {
return this.each(function () {
this.ftoolbar && (this.toggleToolbar = this.clearToolbar = this.triggerToolbar = null, this.ftoolbar = !1, a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())
})
},
destroyGroupHeader: function (b) {
void 0 === b && (b = !0);
return this.each(function () {
var c, d, h, k, e, s;
d = this.grid;
var f = a("table.ui-jqgrid-htable thead", d.hDiv),
g = this.p.colModel;
if (d) {
a(this).unbind(".setGroupHeaders");
c = a("
", {
role: "rowheader"
}).addClass("ui-jqgrid-labels");
k = d.headers;
d = 0;
for (h = k.length; d < h; d++) {
e = g[d].hidden ? "none" : "";
e = a(k[d].el).width(k[d].width).css("display", e);
try {
e.removeAttr("rowSpan")
} catch (m) {
e.attr("rowSpan", 1)
}
c.append(e);
s = e.children("span.ui-jqgrid-resize");
0 < s.length && (s[0].style.height = "");
e.children("div")[0].style.top = ""
}
a(f).children("tr.ui-jqgrid-labels").remove();
a(f).prepend(c); !0 === b && a(this).jqGrid("setGridParam", {
groupHeader: null
})
}
})
},
setGroupHeaders: function (b) {
b = a.extend({
useColSpanStyle: !1,
groupHeaders: []
},
b || {});
return this.each(function () {
this.p.groupHeader = b;
var c, d, h = 0,
k, e, s, f, g, m = this.p.colModel,
x = m.length,
q = this.grid.headers,
p = a("table.ui-jqgrid-htable", this.grid.hDiv),
l = p.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");
k = p.children("thead");
var n = p.find(".jqg-first-row-header");
void 0 === n[0] ? n = a("
", {
role: "row",
"aria-hidden": "true"
}).addClass("jqg-first-row-header").css("height", "auto") : n.empty();
var r, w = function (a, b) {
var c = b.length,
d;
for (d = 0; d < c; d++) if (b[d].startColumnName === a) return d;
return -1
};
a(this).prepend(k);
k = a("
", {
role: "rowheader"
}).addClass("ui-jqgrid-labels jqg-third-row-header");
for (c = 0; c < x; c++) if (s = q[c].el, f = a(s), d = m[c], e = {
height: "0px",
width: q[c].width + "px",
display: d.hidden ? "none" : ""
},
a("
", {
role: "gridcell"
}).css(e).addClass("ui-first-th-" + this.p.direction).appendTo(n), s.style.width = "", e = w(d.name, b.groupHeaders), 0 <= e) {
e = b.groupHeaders[e];
h = e.numberOfColumns;
g = e.titleText;
for (e = d = 0; e < h && c + e < x; e++) m[c + e].hidden || d++;
e = a("
";
return !1
}
});
a += r
}
return a
}
var e = this,
f = e.p.groupingView,
h = "",
p = "",
r, q, n = f.groupCollapse ? f.plusicon : f.minusicon,
t,
y = [],
z = f.groupField.length,
n = n + (" tree-wrap-" + e.p.direction);
d.each(e.p.colModel,
function (a, b) {
var c;
for (c = 0; c < z; c++) if (f.groupField[c] === b.name) {
y[c] = a;
break
}
});
var x = 0,
A = d.makeArray(f.groupSummary);
A.reverse();
d.each(f.groups,
function (g, l) {
if (f._locgr && !(l.startRow + l.cnt > (a - 1) * c && l.startRow < a * c)) return !0;
x++;
q = e.p.id + "ghead_" + l.idx;
r = q + "_" + g;
p = "";
try {
d.isArray(f.formatDisplayField) && d.isFunction(f.formatDisplayField[l.idx]) ? (l.displayValue = f.formatDisplayField[l.idx].call(e, l.displayValue, l.value, e.p.colModel[y[l.idx]], l.idx, f), t = l.displayValue) : t = e.formatter(r, l.displayValue, y[l.idx], l.value)
} catch (C) {
t = l.displayValue
}
"header" === f.groupSummaryPos[l.idx] ? (h += '
' + p + d.jgrid.template(f.groupText[l.idx], t, l.cnt, l.summary) + "
", h += m(g, l.idx - 1, f.groups, 1), h += "
") : h += '
' + p + d.jgrid.template(f.groupText[l.idx], t, l.cnt, l.summary) + "
";
if (z - 1 === l.idx) {
var s = f.groups[g + 1],
v,
u = 0;
v = l.startRow;
var B = void 0 !== s ? f.groups[g + 1].startRow : b.length;
f._locgr && (u = (a - 1) * c, u > l.startRow && (v = u));
for (; v < B && b[v - u]; v++) h += b[v - u].join("");
if ("header" !== f.groupSummaryPos[l.idx]) {
var w;
if (void 0 !== s) {
for (w = 0; w < f.groupField.length && s.dataIndex !== f.groupField[w]; w++);
x = f.groupField.length - w
}
for (s = 0; s < x; s++) A[s] && (u = "", f.groupCollapse && !f.showSummaryOnHide && (u = ' style="display:none;"'), h += "
', h += m(g, s, f.groups, 0), h += "
");
x = w
}
}
});
d("#" + d.jgrid.jqID(e.p.id) + " tbody:first").append(h);
h = null
})
},
groupingGroupBy: function (b, k) {
return this.each(function () {
"string" === typeof b && (b = [b]);
var a = this.p.groupingView;
this.p.grouping = !0;
void 0 === a.visibiltyOnNextGrouping && (a.visibiltyOnNextGrouping = []);
var c;
for (c = 0; c < a.groupField.length; c++) !a.groupColumnShow[c] && a.visibiltyOnNextGrouping[c] && d(this).jqGrid("showCol", a.groupField[c]);
for (c = 0; c < b.length; c++) a.visibiltyOnNextGrouping[c] = d("#" + d.jgrid.jqID(this.p.id) + "_" + d.jgrid.jqID(b[c])).is(":visible");
this.p.groupingView = d.extend(this.p.groupingView, k || {});
a.groupField = b;
d(this).trigger("reloadGrid")
})
},
groupingRemove: function (b) {
return this.each(function () {
void 0 === b && (b = !0);
this.p.grouping = !1;
if (!0 === b) {
var k = this.p.groupingView,
a;
for (a = 0; a < k.groupField.length; a++) !k.groupColumnShow[a] && k.visibiltyOnNextGrouping[a] && d(this).jqGrid("showCol", k.groupField);
d("tr.jqgroup, tr.jqfoot", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").remove();
d("tr.jqgrow:hidden", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").show()
} else d(this).trigger("reloadGrid")
})
},
groupingCalculations: {
handler: function (b, d, a, c, g, m) {
var e = {
sum: function () {
return parseFloat(d || 0) + parseFloat(m[a] || 0)
},
min: function () {
return "" === d ? parseFloat(m[a] || 0) : Math.min(parseFloat(d), parseFloat(m[a] || 0))
},
max: function () {
return "" === d ? parseFloat(m[a] || 0) : Math.max(parseFloat(d), parseFloat(m[a] || 0))
},
count: function () {
"" === d && (d = 0);
return m.hasOwnProperty(a) ? d + 1 : 0
},
avg: function () {
return e.sum()
}
};
if (!e[b]) throw "jqGrid Grouping No such method: " + b;
b = e[b]();
null != c && ("fixed" === g ? b = b.toFixed(c) : (c = Math.pow(10, c), b = Math.round(b * c) / c));
return b
}
}
})
})(jQuery); (function (d) {
d.jgrid.extend({
setTreeNode: function (b, c) {
return this.each(function () {
var a = this;
if (a.grid && a.p.treeGrid) for (var h = a.p.expColInd,
e = a.p.treeReader.expanded_field,
k = a.p.treeReader.leaf_field,
g = a.p.treeReader.level_field,
f = a.p.treeReader.icon_field,
n = a.p.treeReader.loaded,
m, p, q, l; b < c;) l = d.jgrid.stripPref(a.p.idPrefix, a.rows[b].id),
l = a.p.data[a.p._index[l]],
"nested" !== a.p.treeGridModel || l[k] || (m = parseInt(l[a.p.treeReader.left_field], 10), p = parseInt(l[a.p.treeReader.right_field], 10), l[k] = p === m + 1 ? "true" : "false", a.rows[b].cells[a.p._treeleafpos].innerHTML = l[k]),
m = parseInt(l[g], 10),
0 === a.p.tree_root_level ? (q = m + 1, p = m) : (q = m, p = m - 1),
q = "
",
q += "
",
d(a.rows[b].cells[h]).wrapInner("").prepend(q),
m !== parseInt(a.p.tree_root_level, 10) && ((l = (l = d(a).jqGrid("getNodeParent", l)) && l.hasOwnProperty(e) ? l[e] : !0) || d(a.rows[b]).css("display", "none")),
d(a.rows[b].cells[h]).find("div.treeclick").bind("click",
function (b) {
b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
b = a.p._index[b];
a.p.data[b][k] || (a.p.data[b][e] ? (d(a).jqGrid("collapseRow", a.p.data[b]), d(a).jqGrid("collapseNode", a.p.data[b])) : (d(a).jqGrid("expandRow", a.p.data[b]), d(a).jqGrid("expandNode", a.p.data[b])));
return !1
}),
!0 === a.p.ExpandColClick && d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor", "pointer").bind("click",
function (b) {
b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
var c = a.p._index[b];
a.p.data[c][k] || (a.p.data[c][e] ? (d(a).jqGrid("collapseRow", a.p.data[c]), d(a).jqGrid("collapseNode", a.p.data[c])) : (d(a).jqGrid("expandRow", a.p.data[c]), d(a).jqGrid("expandNode", a.p.data[c])));
d(a).jqGrid("setSelection", b);
return !1
}),
b++
})
},
setTreeGrid: function () {
return this.each(function () {
var b = this,
c = 0,
a, h = !1,
e, k, g = [];
if (b.p.treeGrid) {
b.p.treedatatype || d.extend(b.p, {
treedatatype: b.p.datatype
});
b.p.subGrid = !1;
b.p.altRows = !1;
b.p.pgbuttons = !1;
b.p.pginput = !1;
b.p.gridview = !0;
null === b.p.rowTotal && (b.p.rowNum = 1E4);
b.p.multiselect = !1;
b.p.rowList = [];
b.p.expColInd = 0;
a = "ui-icon-triangle-1-" + ("rtl" === b.p.direction ? "w" : "e");
b.p.treeIcons = d.extend({
plus: a,
minus: "ui-icon-triangle-1-s",
leaf: "ui-icon-radio-off"
},
b.p.treeIcons || {});
"nested" === b.p.treeGridModel ? b.p.treeReader = d.extend({
level_field: "level",
left_field: "lft",
right_field: "rgt",
leaf_field: "isLeaf",
expanded_field: "expanded",
loaded: "loaded",
icon_field: "icon"
},
b.p.treeReader) : "adjacency" === b.p.treeGridModel && (b.p.treeReader = d.extend({
level_field: "level",
parent_id_field: "parent",
leaf_field: "isLeaf",
expanded_field: "expanded",
loaded: "loaded",
icon_field: "icon"
},
b.p.treeReader));
for (e in b.p.colModel) if (b.p.colModel.hasOwnProperty(e)) for (k in a = b.p.colModel[e].name, a !== b.p.ExpandColumn || h || (h = !0, b.p.expColInd = c), c++, b.p.treeReader) b.p.treeReader.hasOwnProperty(k) && b.p.treeReader[k] === a && g.push(a);
d.each(b.p.treeReader,
function (a, e) {
e && -1 === d.inArray(e, g) && ("leaf_field" === a && (b.p._treeleafpos = c), c++, b.p.colNames.push(e), b.p.colModel.push({
name: e,
width: 1,
hidden: !0,
sortable: !1,
resizable: !1,
hidedlg: !0,
editable: !0,
search: !1
}))
})
}
})
},
expandRow: function (b) {
this.each(function () {
var c = this;
if (c.grid && c.p.treeGrid) {
var a = d(c).jqGrid("getNodeChildren", b),
h = c.p.treeReader.expanded_field;
d(a).each(function () {
var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
d(d(c).jqGrid("getGridRowById", a)).css("display", "");
this[h] && d(c).jqGrid("expandRow", this)
})
}
})
},
collapseRow: function (b) {
this.each(function () {
var c = this;
if (c.grid && c.p.treeGrid) {
var a = d(c).jqGrid("getNodeChildren", b),
h = c.p.treeReader.expanded_field;
d(a).each(function () {
var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
d(d(c).jqGrid("getGridRowById", a)).css("display", "none");
this[h] && d(c).jqGrid("collapseRow", this)
})
}
})
},
getRootNodes: function () {
var b = [];
this.each(function () {
var c = this;
if (c.grid && c.p.treeGrid) switch (c.p.treeGridModel) {
case "nested":
var a = c.p.treeReader.level_field;
d(c.p.data).each(function () {
parseInt(this[a], 10) === parseInt(c.p.tree_root_level, 10) && b.push(this)
});
break;
case "adjacency":
var h = c.p.treeReader.parent_id_field;
d(c.p.data).each(function () {
null !== this[h] && "null" !== String(this[h]).toLowerCase() || b.push(this)
})
}
});
return b
},
getNodeDepth: function (b) {
var c = null;
this.each(function () {
if (this.grid && this.p.treeGrid) switch (this.p.treeGridModel) {
case "nested":
c = parseInt(b[this.p.treeReader.level_field], 10) - parseInt(this.p.tree_root_level, 10);
break;
case "adjacency":
c = d(this).jqGrid("getNodeAncestors", b).length
}
});
return c
},
getNodeParent: function (b) {
var c = null;
this.each(function () {
var a = this;
if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
case "nested":
var h = a.p.treeReader.left_field,
e = a.p.treeReader.right_field,
k = a.p.treeReader.level_field,
g = parseInt(b[h], 10),
f = parseInt(b[e], 10),
n = parseInt(b[k], 10);
d(this.p.data).each(function () {
if (parseInt(this[k], 10) === n - 1 && parseInt(this[h], 10) < g && parseInt(this[e], 10) > f) return c = this,
!1
});
break;
case "adjacency":
var m = a.p.treeReader.parent_id_field,
p = a.p.localReader.id;
d(this.p.data).each(function () {
if (this[p] === d.jgrid.stripPref(a.p.idPrefix, b[m])) return c = this,
!1
})
}
});
return c
},
getNodeChildren: function (b) {
var c = [];
this.each(function () {
var a = this;
if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
case "nested":
var h = a.p.treeReader.left_field,
e = a.p.treeReader.right_field,
k = a.p.treeReader.level_field,
g = parseInt(b[h], 10),
f = parseInt(b[e], 10),
n = parseInt(b[k], 10);
d(this.p.data).each(function () {
parseInt(this[k], 10) === n + 1 && parseInt(this[h], 10) > g && parseInt(this[e], 10) < f && c.push(this)
});
break;
case "adjacency":
var m = a.p.treeReader.parent_id_field,
p = a.p.localReader.id;
d(this.p.data).each(function () {
this[m] == d.jgrid.stripPref(a.p.idPrefix, b[p]) && c.push(this)
})
}
});
return c
},
getFullTreeNode: function (b) {
var c = [];
this.each(function () {
var a = this,
h;
if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
case "nested":
var e = a.p.treeReader.left_field,
k = a.p.treeReader.right_field,
g = a.p.treeReader.level_field,
f = parseInt(b[e], 10),
n = parseInt(b[k], 10),
m = parseInt(b[g], 10);
d(this.p.data).each(function () {
parseInt(this[g], 10) >= m && parseInt(this[e], 10) >= f && parseInt(this[e], 10) <= n && c.push(this)
});
break;
case "adjacency":
if (b) {
c.push(b);
var p = a.p.treeReader.parent_id_field,
q = a.p.localReader.id;
d(this.p.data).each(function (b) {
h = c.length;
for (b = 0; b < h; b++) if (d.jgrid.stripPref(a.p.idPrefix, c[b][q]) === this[p]) {
c.push(this);
break
}
})
}
}
});
return c
},
getNodeAncestors: function (b) {
var c = [];
this.each(function () {
if (this.grid && this.p.treeGrid) for (var a = d(this).jqGrid("getNodeParent", b) ; a;) c.push(a),
a = d(this).jqGrid("getNodeParent", a)
});
return c
},
isVisibleNode: function (b) {
var c = !0;
this.each(function () {
if (this.grid && this.p.treeGrid) {
var a = d(this).jqGrid("getNodeAncestors", b),
h = this.p.treeReader.expanded_field;
d(a).each(function () {
c = c && this[h];
if (!c) return !1
})
}
});
return c
},
isNodeLoaded: function (b) {
var c;
this.each(function () {
if (this.grid && this.p.treeGrid) {
var a = this.p.treeReader.leaf_field,
h = this.p.treeReader.loaded;
c = void 0 !== b ? void 0 !== b[h] ? b[h] : b[a] || 0 < d(this).jqGrid("getNodeChildren", b).length ? !0 : !1 : !1
}
});
return c
},
expandNode: function (b) {
return this.each(function () {
if (this.grid && this.p.treeGrid) {
var c = this.p.treeReader.expanded_field,
a = this.p.treeReader.parent_id_field,
h = this.p.treeReader.loaded,
e = this.p.treeReader.level_field,
k = this.p.treeReader.left_field,
g = this.p.treeReader.right_field;
if (!b[c]) {
var f = d.jgrid.getAccessor(b, this.p.localReader.id),
n = d("#" + this.p.idPrefix + d.jgrid.jqID(f), this.grid.bDiv)[0],
m = this.p._index[f];
d(this).jqGrid("isNodeLoaded", this.p.data[m]) ? (b[c] = !0, d("div.treeclick", n).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus")) : this.grid.hDiv.loading || (b[c] = !0, d("div.treeclick", n).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus"), this.p.treeANode = n.rowIndex, this.p.datatype = this.p.treedatatype, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
postData: {
nodeid: f,
n_left: b[k],
n_right: b[g],
n_level: b[e]
}
}) : d(this).jqGrid("setGridParam", {
postData: {
nodeid: f,
parentid: b[a],
n_level: b[e]
}
}), d(this).trigger("reloadGrid"), b[h] = !0, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
postData: {
nodeid: "",
n_left: "",
n_right: "",
n_level: ""
}
}) : d(this).jqGrid("setGridParam", {
postData: {
nodeid: "",
parentid: "",
n_level: ""
}
}))
}
}
})
},
collapseNode: function (b) {
return this.each(function () {
if (this.grid && this.p.treeGrid) {
var c = this.p.treeReader.expanded_field;
b[c] && (b[c] = !1, c = d.jgrid.getAccessor(b, this.p.localReader.id), c = d("#" + this.p.idPrefix + d.jgrid.jqID(c), this.grid.bDiv)[0], d("div.treeclick", c).removeClass(this.p.treeIcons.minus + " tree-minus").addClass(this.p.treeIcons.plus + " tree-plus"))
}
})
},
SortTree: function (b, c, a, h) {
return this.each(function () {
if (this.grid && this.p.treeGrid) {
var e, k, g, f = [],
n = this,
m;
e = d(this).jqGrid("getRootNodes");
e = d.jgrid.from(e);
e.orderBy(b, c, a, h);
m = e.select();
e = 0;
for (k = m.length; e < k; e++) g = m[e],
f.push(g),
d(this).jqGrid("collectChildrenSortTree", f, g, b, c, a, h);
d.each(f,
function (a) {
var b = d.jgrid.getAccessor(this, n.p.localReader.id);
d("#" + d.jgrid.jqID(n.p.id) + " tbody tr:eq(" + a + ")").after(d("tr#" + d.jgrid.jqID(b), n.grid.bDiv))
});
f = m = e = null
}
})
},
collectChildrenSortTree: function (b, c, a, h, e, k) {
return this.each(function () {
if (this.grid && this.p.treeGrid) {
var g, f, n, m;
g = d(this).jqGrid("getNodeChildren", c);
g = d.jgrid.from(g);
g.orderBy(a, h, e, k);
m = g.select();
g = 0;
for (f = m.length; g < f; g++) n = m[g],
b.push(n),
d(this).jqGrid("collectChildrenSortTree", b, n, a, h, e, k)
}
})
},
setTreeRow: function (b, c) {
var a = !1;
this.each(function () {
this.grid && this.p.treeGrid && (a = d(this).jqGrid("setRowData", b, c))
});
return a
},
delTreeNode: function (b) {
return this.each(function () {
var c = this.p.localReader.id,
a, h = this.p.treeReader.left_field,
e = this.p.treeReader.right_field,
k, g, f;
if (this.grid && this.p.treeGrid && (a = this.p._index[b], void 0 !== a)) {
k = parseInt(this.p.data[a][e], 10);
g = k - parseInt(this.p.data[a][h], 10) + 1;
var n = d(this).jqGrid("getFullTreeNode", this.p.data[a]);
if (0 < n.length) for (a = 0; a < n.length; a++) d(this).jqGrid("delRowData", n[a][c]);
if ("nested" === this.p.treeGridModel) {
c = d.jgrid.from(this.p.data).greater(h, k, {
stype: "integer"
}).select();
if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][h] = parseInt(c[f][h], 10) - g);
c = d.jgrid.from(this.p.data).greater(e, k, {
stype: "integer"
}).select();
if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][e] = parseInt(c[f][e], 10) - g)
}
}
})
},
addChildNode: function (b, c, a, h) {
var e = this[0];
if (a) {
var k = e.p.treeReader.expanded_field,
g = e.p.treeReader.leaf_field,
f = e.p.treeReader.level_field,
n = e.p.treeReader.parent_id_field,
m = e.p.treeReader.left_field,
p = e.p.treeReader.right_field,
q = e.p.treeReader.loaded,
l, u, t, w, s;
l = 0;
var v = c,
x;
void 0 === h && (h = !1);
if (void 0 === b || null === b) {
s = e.p.data.length - 1;
if (0 <= s) for (; 0 <= s;) l = Math.max(l, parseInt(e.p.data[s][e.p.localReader.id], 10)),
s--;
b = l + 1
}
var y = d(e).jqGrid("getInd", c);
x = !1;
void 0 === c || null === c || "" === c ? (v = c = null, l = "last", w = e.p.tree_root_level, s = e.p.data.length + 1) : (l = "after", u = e.p._index[c], t = e.p.data[u], c = t[e.p.localReader.id], w = parseInt(t[f], 10) + 1, s = d(e).jqGrid("getFullTreeNode", t), s.length ? (v = s = s[s.length - 1][e.p.localReader.id], s = d(e).jqGrid("getInd", v) + 1) : s = d(e).jqGrid("getInd", c) + 1, t[g] && (x = !0, t[k] = !0, d(e.rows[y]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf + " tree-leaf").addClass(e.p.treeIcons.minus + " tree-minus"), e.p.data[u][g] = !1, t[q] = !0));
u = s + 1;
void 0 === a[k] && (a[k] = !1);
void 0 === a[q] && (a[q] = !1);
a[f] = w;
void 0 === a[g] && (a[g] = !0);
"adjacency" === e.p.treeGridModel && (a[n] = c);
if ("nested" === e.p.treeGridModel) {
var r;
if (null !== c) {
g = parseInt(t[p], 10);
f = d.jgrid.from(e.p.data);
f = f.greaterOrEquals(p, g, {
stype: "integer"
});
f = f.select();
if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = f[r][m] > g ? parseInt(f[r][m], 10) + 2 : f[r][m], f[r][p] = f[r][p] >= g ? parseInt(f[r][p], 10) + 2 : f[r][p]);
a[m] = g;
a[p] = g + 1
} else {
g = parseInt(d(e).jqGrid("getCol", p, !1, "max"), 10);
f = d.jgrid.from(e.p.data).greater(m, g, {
stype: "integer"
}).select();
if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = parseInt(f[r][m], 10) + 2);
f = d.jgrid.from(e.p.data).greater(p, g, {
stype: "integer"
}).select();
if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][p] = parseInt(f[r][p], 10) + 2);
a[m] = g + 1;
a[p] = g + 2
}
}
if (null === c || d(e).jqGrid("isNodeLoaded", t) || x) d(e).jqGrid("addRowData", b, a, l, v),
d(e).jqGrid("setTreeNode", s, u);
t && !t[k] && h && d(e.rows[y]).find("div.treeclick").click()
}
}
})
})(jQuery); (function (d) {
function I(d, n) {
var h, e, v = [],
r;
if (!this || "function" !== typeof d || d instanceof RegExp) throw new TypeError;
r = this.length;
for (h = 0; h < r; h++) if (this.hasOwnProperty(h) && (e = this[h], d.call(n, e, h, this))) {
v.push(e);
break
}
return v
}
d.assocArraySize = function (d) {
var n = 0,
h;
for (h in d) d.hasOwnProperty(h) && n++;
return n
};
d.jgrid.extend({
pivotSetup: function (q, n) {
var h = [],
e = [],
v = [],
r = [],
b = {
grouping: !0,
groupingView: {
groupField: [],
groupSummary: [],
groupSummaryPos: []
}
},
f = [],
c = d.extend({
rowTotals: !1,
rowTotalsText: "Total",
colTotals: !1,
groupSummary: !0,
groupSummaryPos: "header",
frozenStaticCols: !1
},
n || {});
this.each(function () {
function n(C, c, a) {
C = I.call(C, c, a);
return 0 < C.length ? C[0] : null
}
function J(c, a) {
var d = 0,
f = !0,
h;
for (h in c) {
if (c[h] != this[d]) {
f = !1;
break
}
d++;
if (d >= this.length) break
}
f && (D = a);
return f
}
function E(c, a, f, h) {
var g = a.length,
b, k, e, l;
l = d.isArray(f) ? f.length : 1;
r = [];
for (e = r.root = 0; e < l; e++) {
var n = [],
m;
for (b = 0; b < g; b++) {
if (null == f) m = k = d.trim(a[b].member) + "_" + a[b].aggregator;
else {
m = f[e].replace(/\s+/g, "");
try {
k = 1 === g ? m : m + "_" + a[b].aggregator + "_" + b
} catch (v) { }
}
var t = h,
u = k,
x = n,
y = k,
w = h[k],
p = a[b].member,
q = c,
s = void 0;
switch (a[b].aggregator) {
case "sum":
s = parseFloat(w || 0) + parseFloat(q[p] || 0);
break;
case "count":
if ("" === w || null == w) w = 0;
s = q.hasOwnProperty(p) ? w + 1 : 0;
break;
case "min":
s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.min(parseFloat(w), parseFloat(q[p] || 0));
break;
case "max":
s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.max(parseFloat(w), parseFloat(q[p] || 0))
}
t[u] = x[y] = s
}
r[m] = n
}
return h
}
function H(a) {
var d, b, g, k, e;
for (g in a) if (a.hasOwnProperty(g)) {
if ("object" !== typeof a[g] && ("level" === g && (void 0 === F[a.level] && (F[a.level] = "", 0 < a.level && "_r_Totals" !== a.text && (f[a.level - 1] = {
useColSpanStyle: !1,
groupHeaders: []
})), F[a.level] !== a.text && a.children.length && "_r_Totals" !== a.text && 0 < a.level && (f[a.level - 1].groupHeaders.push({
titleText: a.text
}), b = f[a.level - 1].groupHeaders.length, e = 1 === b ? K : G + (b - 1) * z, f[a.level - 1].groupHeaders[b - 1].startColumnName = h[e].name, f[a.level - 1].groupHeaders[b - 1].numberOfColumns = h.length - e, G = h.length), F[a.level] = a.text), a.level === l && "level" === g && 0 < l)) if (1 < z) {
b = 1;
for (d in a.fields) 1 === b && f[l - 1].groupHeaders.push({
startColumnName: d,
numberOfColumns: 1,
titleText: a.text
}),
b++;
f[l - 1].groupHeaders[f[l - 1].groupHeaders.length - 1].numberOfColumns = b - 1
} else f.splice(l - 1, 1);
null != a[g] && "object" === typeof a[g] && H(a[g]);
if ("level" === g && 0 < a.level) for (d in b = 0, a.fields) {
e = {};
for (k in c.aggregates[b]) if (c.aggregates[b].hasOwnProperty(k)) switch (k) {
case "member":
case "label":
case "aggregator":
break;
default:
e[k] = c.aggregates[b][k]
}
1 < z ? (e.name = d, e.label = c.aggregates[b].label || d) : (e.name = a.text, e.label = "_r_Totals" === a.text ? c.rowTotalsText : a.text);
h.push(e);
b++
}
}
}
var m, D, a, y = q.length,
s, l, z, k, p = 0;
c.rowTotals && 0 < c.yDimension.length && (c.yDimension.splice(0, 0, {
dataName: c.yDimension[0].dataName
}), c.yDimension[0].converter = function () {
return "_r_Totals"
});
s = d.isArray(c.xDimension) ? c.xDimension.length : 0;
l = c.yDimension.length;
z = d.isArray(c.aggregates) ? c.aggregates.length : 0;
if (0 === s || 0 === z) throw "xDimension or aggregates optiona are not set!";
var x;
for (a = 0; a < s; a++) x = {
name: c.xDimension[a].dataName,
frozen: c.frozenStaticCols
},
x = d.extend(!0, x, c.xDimension[a]),
h.push(x);
x = s - 1;
for (var A = {}; p < y;) {
m = q[p];
var t = [],
u = [];
k = {};
a = 0;
do t[a] = d.trim(m[c.xDimension[a].dataName]),
k[c.xDimension[a].dataName] = t[a],
a++;
while (a < s);
var g = 0;
D = -1;
a = n(e, J, t);
if (!a) {
g = 0;
if (1 <= l) {
for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
k = E(m, c.aggregates, u, k)
} else 0 === l && (k = E(m, c.aggregates, null, k));
e.push(k)
} else if (0 <= D) {
g = 0;
if (1 <= l) {
for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
a = E(m, c.aggregates, u, a)
} else 0 === l && (a = E(m, c.aggregates, null, a));
e[D] = a
}
m = 0;
var t = k = null,
B;
for (B in r) {
if (0 === m) A.children && void 0 !== A.children || (A = {
text: B,
level: 0,
children: []
}),
k = A.children;
else {
t = null;
for (a = 0; a < k.length; a++) if (k[a].text === B) {
t = k[a];
break
}
t ? k = t.children : (k.push({
children: [],
text: B,
level: m,
fields: r[B]
}), k = k[k.length - 1].children)
}
m++
}
p++
}
var F = [],
G = h.length,
K = G;
0 < l && (f[l - 1] = {
useColSpanStyle: !1,
groupHeaders: []
});
H(A, 0);
if (c.colTotals) for (p = e.length; p--;) for (a = s; a < h.length; a++) y = h[a].name,
v[y] = v[y] ? v[y] + parseFloat(e[p][y] || 0) : parseFloat(e[p][y] || 0);
if (0 < x) for (a = 0; a < x; a++) b.groupingView.groupField[a] = h[a].name,
b.groupingView.groupSummary[a] = c.groupSummary,
b.groupingView.groupSummaryPos[a] = c.groupSummaryPos;
else b.grouping = !1;
b.sortname = h[x].name;
b.groupingView.hideFirstGroupCol = !0
});
return {
colModel: h,
rows: e,
groupOptions: b,
groupHeaders: f,
summary: v
}
},
jqPivot: function (q, n, h, e) {
return this.each(function () {
function v(b) {
var f = jQuery(r).jqGrid("pivotSetup", b, n),
c = 0 < d.assocArraySize(f.summary) ? !0 : !1,
e = d.jgrid.from(f.rows);
for (b = 0; b < f.groupOptions.groupingView.groupField.length; b++) e.orderBy(f.groupOptions.groupingView.groupField[b], "a", "text", "");
jQuery(r).jqGrid(d.extend({
datastr: d.extend(e.select(), c ? {
userdata: f.summary
} : {}),
datatype: "jsonstring",
footerrow: c,
userDataOnFooter: c,
colModel: f.colModel,
viewrecords: !0,
sortname: n.xDimension[0].dataName
},
h || {},
f.groupOptions));
f = f.groupHeaders;
if (f.length) for (b = 0; b < f.length; b++) f[b] && f[b].groupHeaders.length && jQuery(r).jqGrid("setGroupHeaders", f[b]);
n.frozenStaticCols && jQuery(r).jqGrid("setFrozenColumns")
}
var r = this;
"string" === typeof q ? d.ajax(d.extend({
url: q,
dataType: "json",
success: function (b) {
v(d.jgrid.getAccessor(b, e && e.reader ? e.reader : "rows"))
}
},
e || {})) : v(q)
})
}
})
})(jQuery); (function (c) {
c.jgrid.extend({
jqGridImport: function (a) {
a = c.extend({
imptype: "xml",
impstring: "",
impurl: "",
mtype: "GET",
impData: {},
xmlGrid: {
config: "roots>grid",
data: "roots>rows"
},
jsonGrid: {
config: "grid",
data: "data"
},
ajaxOptions: {}
},
a || {});
return this.each(function () {
var d = this,
f = function (a, b) {
var e = c(b.xmlGrid.config, a)[0],
h = c(b.xmlGrid.data, a)[0],
f,
g;
if (xmlJsonClass.xml2json && c.jgrid.parse) {
e = xmlJsonClass.xml2json(e, " ");
e = c.jgrid.parse(e);
for (g in e) e.hasOwnProperty(g) && (f = e[g]);
h ? (h = e.grid.datatype, e.grid.datatype = "xmlstring", e.grid.datastr = a, c(d).jqGrid(f).jqGrid("setGridParam", {
datatype: h
})) : c(d).jqGrid(f)
} else alert("xml2json or parse are not present")
},
b = function (a, b) {
if (a && "string" === typeof a) {
var e = !1;
c.jgrid.useJSON && (c.jgrid.useJSON = !1, e = !0);
var f = c.jgrid.parse(a);
e && (c.jgrid.useJSON = !0);
e = f[b.jsonGrid.config];
if (f = f[b.jsonGrid.data]) {
var g = e.datatype;
e.datatype = "jsonstring";
e.datastr = f;
c(d).jqGrid(e).jqGrid("setGridParam", {
datatype: g
})
} else c(d).jqGrid(e)
}
};
switch (a.imptype) {
case "xml":
c.ajax(c.extend({
url:
a.impurl,
type: a.mtype,
data: a.impData,
dataType: "xml",
complete: function (b, g) {
"success" === g && (f(b.responseXML, a), c(d).triggerHandler("jqGridImportComplete", [b, a]), c.isFunction(a.importComplete) && a.importComplete(b))
}
},
a.ajaxOptions));
break;
case "xmlstring":
if (a.impstring && "string" === typeof a.impstring) {
var g = c.parseXML(a.impstring);
g && (f(g, a), c(d).triggerHandler("jqGridImportComplete", [g, a]), c.isFunction(a.importComplete) && a.importComplete(g), a.impstring = null);
g = null
}
break;
case "json":
c.ajax(c.extend({
url:
a.impurl,
type: a.mtype,
data: a.impData,
dataType: "json",
complete: function (f) {
try {
b(f.responseText, a),
c(d).triggerHandler("jqGridImportComplete", [f, a]),
c.isFunction(a.importComplete) && a.importComplete(f)
} catch (g) { }
}
},
a.ajaxOptions));
break;
case "jsonstring":
a.impstring && "string" === typeof a.impstring && (b(a.impstring, a), c(d).triggerHandler("jqGridImportComplete", [a.impstring, a]), c.isFunction(a.importComplete) && a.importComplete(a.impstring), a.impstring = null)
}
})
},
jqGridExport: function (a) {
a = c.extend({
exptype: "xmlstring",
root: "grid",
ident: "\t"
},
a || {});
var d = null;
this.each(function () {
if (this.grid) {
var f, b = c.extend(!0, {},
c(this).jqGrid("getGridParam"));
b.rownumbers && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
b.multiselect && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
b.subGrid && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
b.knv = null;
if (b.treeGrid) for (f in b.treeReader) b.treeReader.hasOwnProperty(f) && (b.colNames.splice(b.colNames.length - 1), b.colModel.splice(b.colModel.length - 1));
switch (a.exptype) {
case "xmlstring":
d = "<" + a.root + ">" + xmlJsonClass.json2xml(b, a.ident) + "" + a.root + ">";
break;
case "jsonstring":
d = "{" + xmlJsonClass.toJson(b, a.root, a.ident, !1) + "}",
void 0 !== b.postData.filters && (d = d.replace(/filters":"/, 'filters":'), d = d.replace(/}]}"/, "}]}"))
}
}
});
return d
},
excelExport: function (a) {
a = c.extend({
exptype: "remote",
url: null,
oper: "oper",
tag: "excel",
exportOptions: {}
},
a || {});
return this.each(function () {
if (this.grid) {
var d;
"remote" === a.exptype && (d = c.extend({},
this.p.postData), d[a.oper] = a.tag, d = jQuery.param(d), d = -1 !== a.url.indexOf("?") ? a.url + "&" + d : a.url + "?" + d, window.location = d)
}
})
}
})
})(jQuery);
var xmlJsonClass = {
xml2json: function (a, b) {
9 === a.nodeType && (a = a.documentElement);
var g = this.removeWhite(a),
g = this.toObj(g),
g = this.toJson(g, a.nodeName, "\t");
return "{\n" + b + (b ? g.replace(/\t/g, b) : g.replace(/\t|\n/g, "")) + "\n}"
},
json2xml: function (a, b) {
var g = function (a, b, e) {
var d = "",
f, k;
if (a instanceof Array) if (0 === a.length) d += e + "<" + b + ">__EMPTY_ARRAY_" + b + ">\n";
else for (f = 0, k = a.length; f < k; f += 1) var n = e + g(a[f], b, e + "\t") + "\n",
d = d + n;
else if ("object" === typeof a) {
f = !1;
d += e + "<" + b;
for (k in a) a.hasOwnProperty(k) && ("@" === k.charAt(0) ? d += " " + k.substr(1) + '="' + a[k].toString() + '"' : f = !0);
d += f ? ">" : "/>";
if (f) {
for (k in a) a.hasOwnProperty(k) && ("#text" === k ? d += a[k] : "#cdata" === k ? d += ""
}
} else "function" === typeof a ? d += e + "<" + b + ">" : (void 0 === a && (a = ""), d = '""' === a.toString() || 0 === a.toString().length ? d + (e + "<" + b + ">__EMPTY_STRING_" + b + ">") : d + (e + "<" + b + ">" + a.toString() + "" + b + ">"));
return d
},
f = "",
e;
for (e in a) a.hasOwnProperty(e) && (f += g(a[e], e, ""));
return b ? f.replace(/\t/g, b) : f.replace(/\t|\n/g, "")
},
toObj: function (a) {
var b = {},
g = /function/i;
if (1 === a.nodeType) {
if (a.attributes.length) {
var f;
for (f = 0; f < a.attributes.length; f += 1) b["@" + a.attributes[f].nodeName] = (a.attributes[f].nodeValue || "").toString()
}
if (a.firstChild) {
var e = f = 0,
h = !1,
c;
for (c = a.firstChild; c; c = c.nextSibling) 1 === c.nodeType ? h = !0 : 3 === c.nodeType && c.nodeValue.match(/[^ \f\n\r\t\v]/) ? f += 1 : 4 === c.nodeType && (e += 1);
if (h) if (2 > f && 2 > e) for (this.removeWhite(a), c = a.firstChild; c; c = c.nextSibling) 3 === c.nodeType ? b["#text"] = this.escape(c.nodeValue) : 4 === c.nodeType ? g.test(c.nodeValue) ? b[c.nodeName] = [b[c.nodeName], c.nodeValue] : b["#cdata"] = this.escape(c.nodeValue) : b[c.nodeName] ? b[c.nodeName] instanceof Array ? b[c.nodeName][b[c.nodeName].length] = this.toObj(c) : b[c.nodeName] = [b[c.nodeName], this.toObj(c)] : b[c.nodeName] = this.toObj(c);
else a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : b = this.escape(this.innerXml(a));
else if (f) a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : (b = this.escape(this.innerXml(a)), "__EMPTY_ARRAY_" === b ? b = "[]" : "__EMPTY_STRING_" === b && (b = ""));
else if (e) if (1 < e) b = this.escape(this.innerXml(a));
else for (c = a.firstChild; c; c = c.nextSibling) if (g.test(a.firstChild.nodeValue)) {
b = a.firstChild.nodeValue;
break
} else b["#cdata"] = this.escape(c.nodeValue)
}
a.attributes.length || a.firstChild || (b = null)
} else 9 === a.nodeType ? b = this.toObj(a.documentElement) : alert("unhandled node type: " + a.nodeType);
return b
},
toJson: function (a, b, g, f) {
void 0 === f && (f = !0);
var e = b ? '"' + b + '"' : "",
h = "\t",
c = "\n";
f || (c = h = "");
if ("[]" === a) e += b ? ":[]" : "[]";
else if (a instanceof Array) {
var l, d, m = [];
d = 0;
for (l = a.length; d < l; d += 1) m[d] = this.toJson(a[d], "", g + h, f);
e += (b ? ":[" : "[") + (1 < m.length ? c + g + h + m.join("," + c + g + h) + c + g : m.join("")) + "]"
} else if (null === a) e += (b && ":") + "null";
else if ("object" === typeof a) {
l = [];
for (d in a) a.hasOwnProperty(d) && (l[l.length] = this.toJson(a[d], d, g + h, f));
e += (b ? ":{" : "{") + (1 < l.length ? c + g + h + l.join("," + c + g + h) + c + g : l.join("")) + "}"
} else e = "string" === typeof a ? e + ((b && ":") + '"' + a.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"') : e + ((b && ":") + a.toString());
return e
},
innerXml: function (a) {
var b = "";
if ("innerHTML" in a) b = a.innerHTML;
else {
var g = function (a) {
var b = "",
h;
if (1 === a.nodeType) {
b += "<" + a.nodeName;
for (h = 0; h < a.attributes.length; h += 1) b += " " + a.attributes[h].nodeName + '="' + (a.attributes[h].nodeValue || "").toString() + '"';
if (a.firstChild) {
b += ">";
for (h = a.firstChild; h; h = h.nextSibling) b += g(h);
b += "" + a.nodeName + ">"
} else b += "/>"
} else 3 === a.nodeType ? b += a.nodeValue : 4 === a.nodeType && (b += " tr", jQuery(this)).each(function () {
var b = {},
a = 0;
jQuery("td", jQuery(this)).each(function () {
if (0 === a && k) {
var c = jQuery("input", jQuery(this)),
e = c.attr("value");
g.push(e || f.length);
c.is(":checked") && h.push(e);
b[d[a].name] = c.attr("value")
} else b[d[a].name] = jQuery(this).html();
a++
});
0 < a && f.push(b)
});
jQuery(this).empty();
jQuery(this).addClass("scroll");
jQuery(this).jqGrid(jQuery.extend({
datatype: "local",
width: b,
colNames: e,
colModel: d,
multiselect: c
},
m || {}));
for (b = 0; b < f.length; b++) a = null,
0 < g.length && (a = g[b]) && a.replace && (a = encodeURIComponent(a).replace(/[.\-%]/g, "_")),
null === a && (a = b + 1),
jQuery(this).jqGrid("addRowData", a, f[b]);
for (b = 0; b < h.length; b++) jQuery(this).jqGrid("setSelection", h[b])
}
})
}; (function (b) {
b.jgrid.msie && 8 === b.jgrid.msiever() && (b.expr[":"].hidden = function (b) {
return 0 === b.offsetWidth || 0 === b.offsetHeight || "none" === b.style.display
});
b.jgrid._multiselect = !1;
if (b.ui && b.ui.multiselect) {
if (b.ui.multiselect.prototype._setSelected) {
var r = b.ui.multiselect.prototype._setSelected;
b.ui.multiselect.prototype._setSelected = function (a, d) {
var c = r.call(this, a, d);
if (d && this.selectedList) {
var e = this.element;
this.selectedList.find("li").each(function () {
b(this).data("optionLink") && b(this).data("optionLink").remove().appendTo(e)
})
}
return c
}
}
b.ui.multiselect.prototype.destroy && (b.ui.multiselect.prototype.destroy = function () {
this.element.show();
this.container.remove();
void 0 === b.Widget ? b.widget.prototype.destroy.apply(this, arguments) : b.Widget.prototype.destroy.apply(this, arguments)
});
b.jgrid._multiselect = !0
}
b.jgrid.extend({
sortableColumns: function (a) {
return this.each(function () {
function d() {
c.p.disableClick = !0
}
var c = this,
e = b.jgrid.jqID(c.p.id),
e = {
tolerance: "pointer",
axis: "x",
scrollSensitivity: "1",
items: ">th:not(:has(#jqgh_" + e + "_cb,#jqgh_" + e + "_rn,#jqgh_" + e + "_subgrid),:hidden)",
placeholder: {
element: function (a) {
return b(document.createElement(a[0].nodeName)).addClass(a[0].className + " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]
},
update: function (b, a) {
a.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10));
a.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10))
}
},
update: function (a, e) {
var d = b(e.item).parent(),
d = b(">th", d),
f = {},
g = c.p.id + "_";
b.each(c.p.colModel,
function (b) {
f[this.name] = b
});
var l = [];
d.each(function () {
var a = b(">div", this).get(0).id.replace(/^jqgh_/, "").replace(g, "");
f.hasOwnProperty(a) && l.push(f[a])
});
b(c).jqGrid("remapColumns", l, !0, !0);
b.isFunction(c.p.sortable.update) && c.p.sortable.update(l);
setTimeout(function () {
c.p.disableClick = !1
},
50)
}
};
c.p.sortable.options ? b.extend(e, c.p.sortable.options) : b.isFunction(c.p.sortable) && (c.p.sortable = {
update: c.p.sortable
});
if (e.start) {
var g = e.start;
e.start = function (b, a) {
d();
g.call(this, b, a)
}
} else e.start = d;
c.p.sortable.exclude && (e.items += ":not(" + c.p.sortable.exclude + ")");
a.sortable(e).data("sortable").floating = !0
})
},
columnChooser: function (a) {
function d(a, c) {
a && ("string" === typeof a ? b.fn[a] && b.fn[a].apply(c, b.makeArray(arguments).slice(2)) : b.isFunction(a) && a.apply(c, b.makeArray(arguments).slice(2)))
}
var c = this;
if (!b("#colchooser_" + b.jgrid.jqID(c[0].p.id)).length) {
var e = b('
'),
g = b("select", e);
a = b.extend({
width: 420,
height: 240,
classname: null,
done: function (b) {
b && c.jqGrid("remapColumns", b, !0)
},
msel: "multiselect",
dlog: "dialog",
dialog_opts: {
minWidth: 470
},
dlog_opts: function (a) {
var c = {};
c[a.bSubmit] = function () {
a.apply_perm();
a.cleanup(!1)
};
c[a.bCancel] = function () {
a.cleanup(!0)
};
return b.extend(!0, {
buttons: c,
close: function () {
a.cleanup(!0)
},
modal: a.modal || !1,
resizable: a.resizable || !0,
width: a.width + 20
},
a.dialog_opts || {})
},
apply_perm: function () {
b("option", g).each(function () {
this.selected ? c.jqGrid("showCol", k[this.value].name) : c.jqGrid("hideCol", k[this.value].name)
});
var e = [];
b("option:selected", g).each(function () {
e.push(parseInt(this.value, 10))
});
b.each(e,
function () {
delete p[k[parseInt(this, 10)].name]
});
b.each(p,
function () {
var b = parseInt(this, 10);
var a = e,
c = b;
if (0 <= c) {
var d = a.slice(),
k = d.splice(c, Math.max(a.length - c, c));
c > a.length && (c = a.length);
d[c] = b;
e = d.concat(k)
} else e = void 0
});
a.done && a.done.call(c, e)
},
cleanup: function (b) {
d(a.dlog, e, "destroy");
d(a.msel, g, "destroy");
e.remove();
b && a.done && a.done.call(c)
},
msel_opts: {}
},
b.jgrid.col, a || {});
if (b.ui && b.ui.multiselect && "multiselect" === a.msel) {
if (!b.jgrid._multiselect) {
alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
return
}
a.msel_opts = b.extend(b.ui.multiselect.defaults, a.msel_opts)
}
a.caption && e.attr("title", a.caption);
a.classname && (e.addClass(a.classname), g.addClass(a.classname));
a.width && (b(">div", e).css({
width: a.width,
margin: "0 auto"
}), g.css("width", a.width));
a.height && (b(">div", e).css("height", a.height), g.css("height", a.height - 10));
var k = c.jqGrid("getGridParam", "colModel"),
t = c.jqGrid("getGridParam", "colNames"),
p = {},
f = [];
g.empty();
b.each(k,
function (a) {
p[this.name] = a;
this.hidedlg ? this.hidden || f.push(a) : g.append("")
});
var q = b.isFunction(a.dlog_opts) ? a.dlog_opts.call(c, a) : a.dlog_opts;
d(a.dlog, e, q);
q = b.isFunction(a.msel_opts) ? a.msel_opts.call(c, a) : a.msel_opts;
d(a.msel, g, q)
}
},
sortableRows: function (a) {
return this.each(function () {
var d = this;
d.grid && !d.p.treeGrid && b.fn.sortable && (a = b.extend({
cursor: "move",
axis: "y",
items: ".jqgrow"
},
a || {}), a.start && b.isFunction(a.start) ? (a._start_ = a.start, delete a.start) : a._start_ = !1, a.update && b.isFunction(a.update) ? (a._update_ = a.update, delete a.update) : a._update_ = !1, a.start = function (c, e) {
b(e.item).css("border-width", "0");
b("td", e.item).each(function (b) {
this.style.width = d.grid.cols[b].style.width
});
if (d.p.subGrid) {
var g = b(e.item).attr("id");
try {
b(d).jqGrid("collapseSubGridRow", g)
} catch (k) { }
}
a._start_ && a._start_.apply(this, [c, e])
},
a.update = function (c, e) {
b(e.item).css("border-width", ""); !0 === d.p.rownumbers && b("td.jqgrid-rownum", d.rows).each(function (a) {
b(this).html(a + 1 + (parseInt(d.p.page, 10) - 1) * parseInt(d.p.rowNum, 10))
});
a._update_ && a._update_.apply(this, [c, e])
},
b("tbody:first", d).sortable(a), b("tbody:first", d).disableSelection())
})
},
gridDnD: function (a) {
return this.each(function () {
function d() {
var a = b.data(c, "dnd");
b("tr.jqgrow:not(.ui-draggable)", c).draggable(b.isFunction(a.drag) ? a.drag.call(b(c), a) : a.drag)
}
var c = this,
e, g;
if (c.grid && !c.p.treeGrid && b.fn.draggable && b.fn.droppable) if (void 0 === b("#jqgrid_dnd")[0] && b("body").append("
"), "string" === typeof a && "updateDnD" === a && !0 === c.p.jqgdnd) d();
else if (a = b.extend({
drag: function (a) {
return b.extend({
start: function (e, d) {
var f;
if (c.p.subGrid) {
f = b(d.helper).attr("id");
try {
b(c).jqGrid("collapseSubGridRow", f)
} catch (g) { }
}
for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) 0 === b(b.data(c, "dnd").connectWith[f]).jqGrid("getGridParam", "reccount") && b(b.data(c, "dnd").connectWith[f]).jqGrid("addRowData", "jqg_empty_row", {});
d.helper.addClass("ui-state-highlight");
b("td", d.helper).each(function (b) {
this.style.width = c.grid.headers[b].width + "px"
});
a.onstart && b.isFunction(a.onstart) && a.onstart.call(b(c), e, d)
},
stop: function (e, d) {
var f;
d.helper.dropped && !a.dragcopy && (f = b(d.helper).attr("id"), void 0 === f && (f = b(this).attr("id")), b(c).jqGrid("delRowData", f));
for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) b(b.data(c, "dnd").connectWith[f]).jqGrid("delRowData", "jqg_empty_row");
a.onstop && b.isFunction(a.onstop) && a.onstop.call(b(c), e, d)
}
},
a.drag_opts || {})
},
drop: function (a) {
return b.extend({
accept: function (a) {
if (!b(a).hasClass("jqgrow")) return a;
a = b(a).closest("table.ui-jqgrid-btable");
return 0 < a.length && void 0 !== b.data(a[0], "dnd") ? (a = b.data(a[0], "dnd").connectWith, -1 !== b.inArray("#" + b.jgrid.jqID(this.id), a) ? !0 : !1) : !1
},
drop: function (e, d) {
if (b(d.draggable).hasClass("jqgrow")) {
var f = b(d.draggable).attr("id"),
f = d.draggable.parent().parent().jqGrid("getRowData", f);
if (!a.dropbyname) {
var g = 0,
l = {},
h, n, s = b("#" + b.jgrid.jqID(this.id)).jqGrid("getGridParam", "colModel");
try {
for (n in f) f.hasOwnProperty(n) && (h = s[g].name, "cb" !== h && "rn" !== h && "subgrid" !== h && f.hasOwnProperty(n) && s[g] && (l[h] = f[n]), g++);
f = l
} catch (r) { }
}
d.helper.dropped = !0;
a.beforedrop && b.isFunction(a.beforedrop) && (h = a.beforedrop.call(this, e, d, f, b("#" + b.jgrid.jqID(c.p.id)), b(this)), void 0 !== h && null !== h && "object" === typeof h && (f = h));
if (d.helper.dropped) {
var m;
a.autoid && (b.isFunction(a.autoid) ? m = a.autoid.call(this, f) : (m = Math.ceil(1E3 * Math.random()), m = a.autoidprefix + m));
b("#" + b.jgrid.jqID(this.id)).jqGrid("addRowData", m, f, a.droppos)
}
a.ondrop && b.isFunction(a.ondrop) && a.ondrop.call(this, e, d, f)
}
}
},
a.drop_opts || {})
},
onstart: null,
onstop: null,
beforedrop: null,
ondrop: null,
drop_opts: {
activeClass: "ui-state-active",
hoverClass: "ui-state-hover"
},
drag_opts: {
revert: "invalid",
helper: "clone",
cursor: "move",
appendTo: "#jqgrid_dnd",
zIndex: 5E3
},
dragcopy: !1,
dropbyname: !1,
droppos: "first",
autoid: !0,
autoidprefix: "dnd_"
},
a || {}), a.connectWith) for (a.connectWith = a.connectWith.split(","), a.connectWith = b.map(a.connectWith,
function (a) {
return b.trim(a)
}), b.data(c, "dnd", a), 0 === c.p.reccount || c.p.jqgdnd || d(), c.p.jqgdnd = !0, e = 0; e < a.connectWith.length; e++) g = a.connectWith[e],
b(g).droppable(b.isFunction(a.drop) ? a.drop.call(b(c), a) : a.drop)
})
},
gridResize: function (a) {
return this.each(function () {
var d = this,
c = b.jgrid.jqID(d.p.id);
d.grid && b.fn.resizable && (a = b.extend({},
a || {}), a.alsoResize ? (a._alsoResize_ = a.alsoResize, delete a.alsoResize) : a._alsoResize_ = !1, a.stop && b.isFunction(a.stop) ? (a._stop_ = a.stop, delete a.stop) : a._stop_ = !1, a.stop = function (e, g) {
b(d).jqGrid("setGridParam", {
height: b("#gview_" + c + " .ui-jqgrid-bdiv").height()
});
b(d).jqGrid("setGridWidth", g.size.width, a.shrinkToFit);
a._stop_ && a._stop_.call(d, e, g)
},
a.alsoResize = a._alsoResize_ ? eval("(" + ("{'#gview_" + c + " .ui-jqgrid-bdiv':true,'" + a._alsoResize_ + "':true}") + ")") : b(".ui-jqgrid-bdiv", "#gview_" + c), delete a._alsoResize_, b("#gbox_" + c).resizable(a))
})
}
})
})(jQuery);