libre-jqgrid 4.17.2 → 4.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tscache/all/hashes/free-jqgrid.d.ts-74303c8b076937117540c0cb798f2053 +1 -0
- package/.tscache/all/hashes/test.ts-0d81877a31bc5d7ac52dd35a66602f01 +1 -0
- package/.tscache/all/timestamp +0 -0
- package/dist/css/ui.jqgrid.css +1618 -0
- package/dist/css/ui.jqgrid.min.css +4 -0
- package/dist/css/ui.jqgrid.min.css.map +1 -0
- package/dist/i18n/grid.locale-ar.js +198 -0
- package/dist/i18n/grid.locale-bg.js +201 -0
- package/dist/i18n/grid.locale-bs.js +230 -0
- package/dist/i18n/grid.locale-ca.js +204 -0
- package/dist/i18n/grid.locale-cn.js +237 -0
- package/dist/i18n/grid.locale-cs.js +197 -0
- package/dist/i18n/grid.locale-da.js +196 -0
- package/dist/i18n/grid.locale-de.js +240 -0
- package/dist/i18n/grid.locale-el.js +195 -0
- package/dist/i18n/grid.locale-en.js +256 -0
- package/dist/i18n/grid.locale-es.js +202 -0
- package/dist/i18n/grid.locale-fa.js +211 -0
- package/dist/i18n/grid.locale-fi.js +201 -0
- package/dist/i18n/grid.locale-fr.js +197 -0
- package/dist/i18n/grid.locale-gl.js +197 -0
- package/dist/i18n/grid.locale-he.js +198 -0
- package/dist/i18n/grid.locale-hr.js +231 -0
- package/dist/i18n/grid.locale-hu.js +196 -0
- package/dist/i18n/grid.locale-id.js +238 -0
- package/dist/i18n/grid.locale-is.js +197 -0
- package/dist/i18n/grid.locale-it.js +189 -0
- package/dist/i18n/grid.locale-ja.js +203 -0
- package/dist/i18n/grid.locale-kr.js +194 -0
- package/dist/i18n/grid.locale-lt.js +199 -0
- package/dist/i18n/grid.locale-me.js +198 -0
- package/dist/i18n/grid.locale-nl.js +208 -0
- package/dist/i18n/grid.locale-no.js +180 -0
- package/dist/i18n/grid.locale-pl.js +204 -0
- package/dist/i18n/grid.locale-pt-br.js +210 -0
- package/dist/i18n/grid.locale-pt.js +196 -0
- package/dist/i18n/grid.locale-ro.js +210 -0
- package/dist/i18n/grid.locale-ru.js +196 -0
- package/dist/i18n/grid.locale-sk.js +198 -0
- package/dist/i18n/grid.locale-sl.js +230 -0
- package/dist/i18n/grid.locale-sr.js +199 -0
- package/dist/i18n/grid.locale-sv.js +198 -0
- package/dist/i18n/grid.locale-th.js +195 -0
- package/dist/i18n/grid.locale-tr.js +197 -0
- package/dist/i18n/grid.locale-tw.js +199 -0
- package/dist/i18n/grid.locale-ua.js +199 -0
- package/dist/i18n/grid.locale-vi.js +238 -0
- package/dist/i18n/min/grid.locale-ar.js +10 -0
- package/dist/i18n/min/grid.locale-ar.js.map +1 -0
- package/dist/i18n/min/grid.locale-bg.js +10 -0
- package/dist/i18n/min/grid.locale-bg.js.map +1 -0
- package/dist/i18n/min/grid.locale-ca.js +15 -0
- package/dist/i18n/min/grid.locale-ca.js.map +1 -0
- package/dist/i18n/min/grid.locale-cn.js +10 -0
- package/dist/i18n/min/grid.locale-cn.js.map +1 -0
- package/dist/i18n/min/grid.locale-cs.js +11 -0
- package/dist/i18n/min/grid.locale-cs.js.map +1 -0
- package/dist/i18n/min/grid.locale-da.js +10 -0
- package/dist/i18n/min/grid.locale-da.js.map +1 -0
- package/dist/i18n/min/grid.locale-de.js +21 -0
- package/dist/i18n/min/grid.locale-de.js.map +1 -0
- package/dist/i18n/min/grid.locale-el.js +10 -0
- package/dist/i18n/min/grid.locale-el.js.map +1 -0
- package/dist/i18n/min/grid.locale-en.js +11 -0
- package/dist/i18n/min/grid.locale-en.js.map +1 -0
- package/dist/i18n/min/grid.locale-es.js +16 -0
- package/dist/i18n/min/grid.locale-es.js.map +1 -0
- package/dist/i18n/min/grid.locale-fa.js +8 -0
- package/dist/i18n/min/grid.locale-fa.js.map +1 -0
- package/dist/i18n/min/grid.locale-fi.js +11 -0
- package/dist/i18n/min/grid.locale-fi.js.map +1 -0
- package/dist/i18n/min/grid.locale-fr.js +10 -0
- package/dist/i18n/min/grid.locale-fr.js.map +1 -0
- package/dist/i18n/min/grid.locale-gl.js +9 -0
- package/dist/i18n/min/grid.locale-gl.js.map +1 -0
- package/dist/i18n/min/grid.locale-he.js +10 -0
- package/dist/i18n/min/grid.locale-he.js.map +1 -0
- package/dist/i18n/min/grid.locale-hr.js +11 -0
- package/dist/i18n/min/grid.locale-hr.js.map +1 -0
- package/dist/i18n/min/grid.locale-hu.js +10 -0
- package/dist/i18n/min/grid.locale-hu.js.map +1 -0
- package/dist/i18n/min/grid.locale-id.js +10 -0
- package/dist/i18n/min/grid.locale-id.js.map +1 -0
- package/dist/i18n/min/grid.locale-is.js +9 -0
- package/dist/i18n/min/grid.locale-is.js.map +1 -0
- package/dist/i18n/min/grid.locale-it.js +2 -0
- package/dist/i18n/min/grid.locale-it.js.map +1 -0
- package/dist/i18n/min/grid.locale-ja.js +10 -0
- package/dist/i18n/min/grid.locale-ja.js.map +1 -0
- package/dist/i18n/min/grid.locale-kr.js +2 -0
- package/dist/i18n/min/grid.locale-kr.js.map +1 -0
- package/dist/i18n/min/grid.locale-lt.js +10 -0
- package/dist/i18n/min/grid.locale-lt.js.map +1 -0
- package/dist/i18n/min/grid.locale-me.js +10 -0
- package/dist/i18n/min/grid.locale-me.js.map +1 -0
- package/dist/i18n/min/grid.locale-nl.js +2 -0
- package/dist/i18n/min/grid.locale-nl.js.map +1 -0
- package/dist/i18n/min/grid.locale-no.js +2 -0
- package/dist/i18n/min/grid.locale-no.js.map +1 -0
- package/dist/i18n/min/grid.locale-pl.js +18 -0
- package/dist/i18n/min/grid.locale-pl.js.map +1 -0
- package/dist/i18n/min/grid.locale-pt-br.js +21 -0
- package/dist/i18n/min/grid.locale-pt-br.js.map +1 -0
- package/dist/i18n/min/grid.locale-pt.js +9 -0
- package/dist/i18n/min/grid.locale-pt.js.map +1 -0
- package/dist/i18n/min/grid.locale-ro.js +10 -0
- package/dist/i18n/min/grid.locale-ro.js.map +1 -0
- package/dist/i18n/min/grid.locale-ru.js +10 -0
- package/dist/i18n/min/grid.locale-ru.js.map +1 -0
- package/dist/i18n/min/grid.locale-sk.js +10 -0
- package/dist/i18n/min/grid.locale-sk.js.map +1 -0
- package/dist/i18n/min/grid.locale-sr.js +10 -0
- package/dist/i18n/min/grid.locale-sr.js.map +1 -0
- package/dist/i18n/min/grid.locale-sv.js +10 -0
- package/dist/i18n/min/grid.locale-sv.js.map +1 -0
- package/dist/i18n/min/grid.locale-th.js +10 -0
- package/dist/i18n/min/grid.locale-th.js.map +1 -0
- package/dist/i18n/min/grid.locale-tr.js +10 -0
- package/dist/i18n/min/grid.locale-tr.js.map +1 -0
- package/dist/i18n/min/grid.locale-tw.js +11 -0
- package/dist/i18n/min/grid.locale-tw.js.map +1 -0
- package/dist/i18n/min/grid.locale-ua.js +10 -0
- package/dist/i18n/min/grid.locale-ua.js.map +1 -0
- package/dist/i18n/min/grid.locale-vi.js +10 -0
- package/dist/i18n/min/grid.locale-vi.js.map +1 -0
- package/dist/jquery.jqgrid.min.js +11 -0
- package/dist/jquery.jqgrid.min.js.map +1 -0
- package/{js/jquery.jqgrid.src.js.1 → dist/jquery.jqgrid.src.js} +1 -1
- package/dist/modules/grid.base.js +8518 -0
- package/dist/modules/grid.celledit.js +673 -0
- package/dist/modules/grid.common.js +844 -0
- package/dist/modules/grid.custom.js +1795 -0
- package/dist/modules/grid.filter.js +897 -0
- package/dist/modules/grid.formedit.js +2537 -0
- package/dist/modules/grid.grouping.js +737 -0
- package/dist/modules/grid.import.js +251 -0
- package/dist/modules/grid.inlinedit.js +784 -0
- package/dist/modules/grid.jqueryui.js +965 -0
- package/dist/modules/grid.pivot.js +862 -0
- package/dist/modules/grid.subgrid.js +379 -0
- package/dist/modules/grid.tbltogrid.js +141 -0
- package/dist/modules/grid.treegrid.js +683 -0
- package/dist/modules/jqdnr.js +188 -0
- package/dist/modules/jqmodal.js +292 -0
- package/dist/modules/jquery.fmatter.js +1061 -0
- package/dist/modules/jsonxml.js +343 -0
- package/dist/modules/min/grid.base.js +11 -0
- package/dist/modules/min/grid.base.js.map +1 -0
- package/dist/modules/min/grid.celledit.js +2 -0
- package/dist/modules/min/grid.celledit.js.map +1 -0
- package/dist/modules/min/grid.common.js +2 -0
- package/dist/modules/min/grid.common.js.map +1 -0
- package/dist/modules/min/grid.custom.js +2 -0
- package/dist/modules/min/grid.custom.js.map +1 -0
- package/dist/modules/min/grid.filter.js +2 -0
- package/dist/modules/min/grid.filter.js.map +1 -0
- package/dist/modules/min/grid.formedit.js +2 -0
- package/dist/modules/min/grid.formedit.js.map +1 -0
- package/dist/modules/min/grid.grouping.js +2 -0
- package/dist/modules/min/grid.grouping.js.map +1 -0
- package/dist/modules/min/grid.import.js +2 -0
- package/dist/modules/min/grid.import.js.map +1 -0
- package/dist/modules/min/grid.inlinedit.js +2 -0
- package/dist/modules/min/grid.inlinedit.js.map +1 -0
- package/dist/modules/min/grid.jqueryui.js +2 -0
- package/dist/modules/min/grid.jqueryui.js.map +1 -0
- package/dist/modules/min/grid.pivot.js +2 -0
- package/dist/modules/min/grid.pivot.js.map +1 -0
- package/dist/modules/min/grid.subgrid.js +2 -0
- package/dist/modules/min/grid.subgrid.js.map +1 -0
- package/dist/modules/min/grid.tbltogrid.js +2 -0
- package/dist/modules/min/grid.tbltogrid.js.map +1 -0
- package/dist/modules/min/grid.treegrid.js +2 -0
- package/dist/modules/min/grid.treegrid.js.map +1 -0
- package/dist/modules/min/jqdnr.js +2 -0
- package/dist/modules/min/jqdnr.js.map +1 -0
- package/dist/modules/min/jqmodal.js +2 -0
- package/dist/modules/min/jqmodal.js.map +1 -0
- package/dist/modules/min/jquery.fmatter.js +2 -0
- package/dist/modules/min/jquery.fmatter.js.map +1 -0
- package/dist/modules/min/jsonxml.js +2 -0
- package/dist/modules/min/jsonxml.js.map +1 -0
- package/dist/plugins/css/ui.multiselect.css +30 -0
- package/dist/plugins/css/ui.multiselect.min.css +2 -0
- package/dist/plugins/css/ui.multiselect.min.css.map +1 -0
- package/dist/plugins/grid.odata.js +1313 -0
- package/dist/plugins/jqgrid_download.js +109 -0
- package/dist/plugins/jquery.contextmenu-ui.js +304 -0
- package/dist/plugins/jquery.contextmenu.js +174 -0
- package/dist/plugins/jquery.createcontexmenufromnavigatorbuttons.js +172 -0
- package/dist/plugins/jquery.jqgrid.showhidecolumnmenu.js +201 -0
- package/dist/plugins/min/grid.odata.js +11 -0
- package/dist/plugins/min/grid.odata.js.map +1 -0
- package/dist/plugins/min/jquery.contextmenu-ui.js +26 -0
- package/dist/plugins/min/jquery.contextmenu-ui.js.map +1 -0
- package/dist/plugins/min/jquery.contextmenu.js +19 -0
- package/dist/plugins/min/jquery.contextmenu.js.map +1 -0
- package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js +12 -0
- package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js.map +1 -0
- package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js +10 -0
- package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js.map +1 -0
- package/dist/plugins/min/ui.multiselect.js +30 -0
- package/dist/plugins/min/ui.multiselect.js.map +1 -0
- package/dist/plugins/ui.multiselect.js +389 -0
- package/dist/ts/free-jqgrid.d.ts +2132 -0
- package/js/jquery.jqgrid.min.js +1 -1
- package/js/jquery.jqgrid.min.js.map +1 -1
- package/js/jquery.jqgrid.src.js +8 -3
- package/libre-jqgrid-4.17.4.tgz +0 -0
- package/package.json +1 -1
- package/.github/workflows/npm.yml +0 -47
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jqGrid extension for SubGrid Data
|
|
3
|
+
* Copyright (c) 2008-2014, Tony Tomov, tony@trirand.com
|
|
4
|
+
* Copyright (c) 2014-2019, Oleg Kiriljuk, oleg.kiriljuk@ok-soft-gmbh.com
|
|
5
|
+
* Copyright (c) 2023, rany2, ranygh@riseup.net
|
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
8
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
|
9
|
+
**/
|
|
10
|
+
|
|
11
|
+
/*jshint eqeqeq:false */
|
|
12
|
+
/*global jQuery, define, exports, module, require */
|
|
13
|
+
/*jslint eqeq: true, nomen: true, plusplus: true, unparam: true, white: true */
|
|
14
|
+
(function (factory) {
|
|
15
|
+
"use strict";
|
|
16
|
+
if (typeof define === "function" && define.amd) {
|
|
17
|
+
// AMD. Register as an anonymous module.
|
|
18
|
+
define([
|
|
19
|
+
"jquery",
|
|
20
|
+
"./grid.base"
|
|
21
|
+
], factory);
|
|
22
|
+
} else if (typeof module === "object" && module.exports) {
|
|
23
|
+
// Node/CommonJS
|
|
24
|
+
module.exports = function (root, $) {
|
|
25
|
+
if (!root) {
|
|
26
|
+
root = window;
|
|
27
|
+
}
|
|
28
|
+
if ($ === undefined) {
|
|
29
|
+
// require("jquery") returns a factory that requires window to
|
|
30
|
+
// build a jQuery instance, we normalize how we use modules
|
|
31
|
+
// that require this pattern but the window provided is a noop
|
|
32
|
+
// if it's defined (how jquery works)
|
|
33
|
+
$ = typeof window !== "undefined" ?
|
|
34
|
+
require("jquery") :
|
|
35
|
+
require("jquery")(root);
|
|
36
|
+
}
|
|
37
|
+
require("./grid.base");
|
|
38
|
+
factory($);
|
|
39
|
+
return $;
|
|
40
|
+
};
|
|
41
|
+
} else {
|
|
42
|
+
// Browser globals
|
|
43
|
+
factory(jQuery);
|
|
44
|
+
}
|
|
45
|
+
}(function ($) {
|
|
46
|
+
"use strict";
|
|
47
|
+
var jgrid = $.jgrid, jqID = jgrid.jqID, base = $.fn.jqGrid;
|
|
48
|
+
// begin module grid.subgrid
|
|
49
|
+
var subGridFeedback = function () {
|
|
50
|
+
var args = $.makeArray(arguments);
|
|
51
|
+
args[0] = "subGrid" + args[0].charAt(0).toUpperCase() + args[0].substring(1);
|
|
52
|
+
args.unshift("");
|
|
53
|
+
args.unshift("");
|
|
54
|
+
args.unshift(this.p);
|
|
55
|
+
return jgrid.feedback.apply(this, args);
|
|
56
|
+
},
|
|
57
|
+
collapseOrExpand = function (rowid, className) {
|
|
58
|
+
return this.each(function () {
|
|
59
|
+
if (this.grid && rowid != null && this.p.subGrid === true) {
|
|
60
|
+
var tr = $(this).jqGrid("getInd", rowid, true);
|
|
61
|
+
$(tr).find(">td." + className).trigger("click");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
jgrid.extend({
|
|
66
|
+
setSubGrid: function () {
|
|
67
|
+
return this.each(function () {
|
|
68
|
+
var p = this.p, $self = $(this), cm = p.subGridModel[0], i,
|
|
69
|
+
getIcon = function (path) {
|
|
70
|
+
return $self.jqGrid("getIconRes", path);
|
|
71
|
+
};
|
|
72
|
+
p.subGridOptions = $.extend({
|
|
73
|
+
commonIconClass: getIcon("subgrid.common"),
|
|
74
|
+
plusicon: getIcon("subgrid.plus"),
|
|
75
|
+
minusicon: getIcon("subgrid.minus"),
|
|
76
|
+
openicon: (p.direction === "rtl" ? getIcon("subgrid.openRtl") : getIcon("subgrid.openLtr")),
|
|
77
|
+
expandOnLoad: false,
|
|
78
|
+
delayOnLoad: 50,
|
|
79
|
+
selectOnExpand: false,
|
|
80
|
+
selectOnCollapse: false,
|
|
81
|
+
reloadOnExpand: true
|
|
82
|
+
}, p.subGridOptions || {});
|
|
83
|
+
p.colNames.unshift("");
|
|
84
|
+
p.colModel.unshift({
|
|
85
|
+
name: "subgrid",
|
|
86
|
+
width: jgrid.cell_width ? p.subGridWidth + p.cellLayout : p.subGridWidth,
|
|
87
|
+
labelClasses: "jqgh_subgrid",
|
|
88
|
+
sortable: false,
|
|
89
|
+
resizable: false,
|
|
90
|
+
hidedlg: true,
|
|
91
|
+
search: false,
|
|
92
|
+
fixed: true,
|
|
93
|
+
frozen: true
|
|
94
|
+
});
|
|
95
|
+
if (cm) {
|
|
96
|
+
cm.align = $.extend([], cm.align || []);
|
|
97
|
+
for (i = 0; i < cm.name.length; i++) {
|
|
98
|
+
cm.align[i] = cm.align[i] || "left";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
addSubGridCell: function (pos, iRow, rowid, item) {
|
|
104
|
+
var self = this[0], subGridOptions = self.p.subGridOptions,
|
|
105
|
+
hasSubgrid = $.jgrid.isFunction(subGridOptions.hasSubgrid) ?
|
|
106
|
+
subGridOptions.hasSubgrid.call(self, { rowid: rowid, iRow: iRow, iCol: pos, data: item }) :
|
|
107
|
+
true;
|
|
108
|
+
return self.p == null ? "" :
|
|
109
|
+
"<td role='gridcell' class='" + base.getGuiStyles.call(this, "subgrid.tdStart", hasSubgrid ? "ui-sgcollapsed sgcollapsed" : "") + "' " +
|
|
110
|
+
self.formatCol(pos, iRow) + ">" +
|
|
111
|
+
(hasSubgrid ? "<div class='" + base.getGuiStyles.call(this, "subgrid.buttonDiv", "sgbutton-div") +
|
|
112
|
+
"'><a role='button' class='" + base.getGuiStyles.call(this, "subgrid.button", "sgbutton") +
|
|
113
|
+
"'><span class='" + jgrid.mergeCssClasses(subGridOptions.commonIconClass, subGridOptions.plusicon) + "'></span></a></div>" : " ") +
|
|
114
|
+
"</td>";
|
|
115
|
+
},
|
|
116
|
+
addSubGrid: function (pos, sind) {
|
|
117
|
+
return this.each(function () {
|
|
118
|
+
var ts = this, p = ts.p, cm = p.subGridModel[0],
|
|
119
|
+
getSubgridStyle = function (name, calsses) {
|
|
120
|
+
return base.getGuiStyles.call(ts, "subgrid." + name, calsses || "");
|
|
121
|
+
},
|
|
122
|
+
thSubgridClasses = getSubgridStyle("thSubgrid", "ui-th-subgrid ui-th-column ui-th-" + p.direction),
|
|
123
|
+
rowSubTableClasses = getSubgridStyle("rowSubTable", "ui-subtblcell"),
|
|
124
|
+
rowClasses = getSubgridStyle("row", "ui-subgrid ui-row-" + p.direction),
|
|
125
|
+
tdWithIconClasses = getSubgridStyle("tdWithIcon", "subgrid-cell"),
|
|
126
|
+
tdDataClasses = getSubgridStyle("tdData", "subgrid-data"),
|
|
127
|
+
subGridCell = function ($tr, cell, pos1) {
|
|
128
|
+
var align = cm.align[pos1],
|
|
129
|
+
$td = $("<td" +
|
|
130
|
+
(align ? " style='text-align:" + align + ";'" : "") +
|
|
131
|
+
"></td>").html(cell);
|
|
132
|
+
$tr.append($td);
|
|
133
|
+
},
|
|
134
|
+
fillXmlBody = function (data, $tbody) {
|
|
135
|
+
var sgmap = p.xmlReader.subgrid;
|
|
136
|
+
$(sgmap.root + " " + sgmap.row, data).each(function () {
|
|
137
|
+
var f, i, $tr = $("<tr class='" + rowSubTableClasses + "'></tr>");
|
|
138
|
+
if (sgmap.repeatitems === true) {
|
|
139
|
+
$(sgmap.cell, this).each(function (j) {
|
|
140
|
+
subGridCell($tr, $(this).text() || " ", j);
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
f = cm.mapping || cm.name;
|
|
144
|
+
if (f) {
|
|
145
|
+
for (i = 0; i < f.length; i++) {
|
|
146
|
+
subGridCell($tr, jgrid.getXmlData(this, f[i]) || " ", i);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
$tbody.append($tr);
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
fillJsonBody = function (data, $tbody) {
|
|
154
|
+
var $tr, i, j, f, cur, sgmap = p.jsonReader.subgrid,
|
|
155
|
+
result = jgrid.getAccessor(data, sgmap.root);
|
|
156
|
+
if (result != null) {
|
|
157
|
+
for (i = 0; i < result.length; i++) {
|
|
158
|
+
cur = result[i];
|
|
159
|
+
$tr = $("<tr class='" + rowSubTableClasses + "'></tr>");
|
|
160
|
+
if (sgmap.repeatitems === true) {
|
|
161
|
+
if (sgmap.cell) {
|
|
162
|
+
cur = cur[sgmap.cell];
|
|
163
|
+
}
|
|
164
|
+
for (j = 0; j < cur.length; j++) {
|
|
165
|
+
subGridCell($tr, cur[j] || " ", j);
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
f = cm.mapping || cm.name;
|
|
169
|
+
if (f.length) {
|
|
170
|
+
for (j = 0; j < f.length; j++) {
|
|
171
|
+
subGridCell($tr, jgrid.getAccessor(cur, f[j]) || " ", j);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
$tbody.append($tr);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
subGridXmlOrJson = function (sjxml, sbid, fullBody) {
|
|
180
|
+
var $th, i, subgridTableClasses = getSubgridStyle("legacyTable", "ui-jqgrid-legacy-subgrid" +
|
|
181
|
+
(p.altRows === true && $(ts).jqGrid("isBootstrapGuiStyle") ? " table-striped" : "")),
|
|
182
|
+
$table = $("<table" +
|
|
183
|
+
(subgridTableClasses ? " style='width:1px' role='presentation' class='" + subgridTableClasses + "'" : "") +
|
|
184
|
+
"><thead></thead><tbody></tbody></table>"),
|
|
185
|
+
$tr = $("<tr></tr>");
|
|
186
|
+
|
|
187
|
+
ts.grid.endReq.call(ts);
|
|
188
|
+
|
|
189
|
+
for (i = 0; i < cm.name.length; i++) {
|
|
190
|
+
$th = $("<th class='" + thSubgridClasses + "'></th>")
|
|
191
|
+
.html(cm.name[i])
|
|
192
|
+
.width(cm.width[i]);
|
|
193
|
+
$tr.append($th);
|
|
194
|
+
}
|
|
195
|
+
$tr.appendTo($table[0].tHead);
|
|
196
|
+
fullBody(sjxml, $($table[0].tBodies[0]));
|
|
197
|
+
$("#" + jqID(p.id + "_" + sbid)).append($table);
|
|
198
|
+
return false;
|
|
199
|
+
},
|
|
200
|
+
populatesubgrid = function (rd) {
|
|
201
|
+
var sid = $(rd).attr("id"), dp = { nd_: (new Date().getTime()) }, iCol, j;
|
|
202
|
+
dp[p.prmNames.subgridid] = sid;
|
|
203
|
+
if (!cm) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (cm.params) {
|
|
207
|
+
for (j = 0; j < cm.params.length; j++) {
|
|
208
|
+
iCol = p.iColByName[cm.params[j]];
|
|
209
|
+
if (iCol !== undefined) {
|
|
210
|
+
dp[p.colModel[iCol].name] = $(rd.cells[iCol]).text().replace(/\ \;/ig, "");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (!ts.grid.hDiv.loading) {
|
|
215
|
+
ts.grid.beginReq.call(ts);
|
|
216
|
+
if (!p.subgridtype) {
|
|
217
|
+
p.subgridtype = p.datatype;
|
|
218
|
+
}
|
|
219
|
+
if ($.jgrid.isFunction(p.subgridtype)) {
|
|
220
|
+
p.subgridtype.call(ts, dp);
|
|
221
|
+
} else {
|
|
222
|
+
p.subgridtype = p.subgridtype.toLowerCase();
|
|
223
|
+
}
|
|
224
|
+
switch (p.subgridtype) {
|
|
225
|
+
case "xml":
|
|
226
|
+
case "json":
|
|
227
|
+
$.ajax($.extend({
|
|
228
|
+
type: p.mtype,
|
|
229
|
+
url: $.jgrid.isFunction(p.subGridUrl) ? p.subGridUrl.call(ts, dp) : p.subGridUrl,
|
|
230
|
+
dataType: p.subgridtype,
|
|
231
|
+
context: sid,
|
|
232
|
+
data: jgrid.serializeFeedback.call(ts, p.serializeSubGridData, "jqGridSerializeSubGridData", dp),
|
|
233
|
+
success: function (data) {
|
|
234
|
+
subGridXmlOrJson(
|
|
235
|
+
data,
|
|
236
|
+
this,
|
|
237
|
+
p.subgridtype === "xml" ? fillXmlBody : fillJsonBody
|
|
238
|
+
);
|
|
239
|
+
},
|
|
240
|
+
error: function (jqXHR, textStatus, errorThrown) {
|
|
241
|
+
var loadError = p.loadSubgridError === undefined ?
|
|
242
|
+
p.loadError :
|
|
243
|
+
p.loadSubgridError;
|
|
244
|
+
|
|
245
|
+
ts.grid.endReq.call(ts);
|
|
246
|
+
if ($.jgrid.isFunction(loadError)) {
|
|
247
|
+
loadError.call(ts, jqXHR, textStatus, errorThrown);
|
|
248
|
+
}
|
|
249
|
+
// for compatibility only
|
|
250
|
+
if (!p.subGridOptions.noEmptySubgridOnError) {
|
|
251
|
+
subGridXmlOrJson(
|
|
252
|
+
null,
|
|
253
|
+
this,
|
|
254
|
+
p.subgridtype === "xml" ? fillXmlBody : fillJsonBody
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}, jgrid.ajaxOptions, p.ajaxSubgridOptions || {}));
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return false;
|
|
263
|
+
},
|
|
264
|
+
onClick = function () {
|
|
265
|
+
var tr = $(this).parent("tr")[0], r = tr.nextSibling, rowid = tr.id, subgridDivId = p.id + "_" + rowid, atd,
|
|
266
|
+
iconClass = function (iconName) {
|
|
267
|
+
return jgrid.mergeCssClasses(p.subGridOptions.commonIconClass, p.subGridOptions[iconName]);
|
|
268
|
+
},
|
|
269
|
+
nhc = 1;
|
|
270
|
+
$.each(p.colModel, function () {
|
|
271
|
+
if (this.hidden === true || this.name === "rn" || this.name === "cb") {
|
|
272
|
+
// ??? probably one should don't calculate hidden columns of subgrid?
|
|
273
|
+
// (remove this.hidden === true part from the if) ???
|
|
274
|
+
nhc++;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
if ($(this).hasClass("sgcollapsed")) {
|
|
278
|
+
if (p.subGridOptions.reloadOnExpand === true || (p.subGridOptions.reloadOnExpand === false && !$(r).hasClass("ui-subgrid"))) {
|
|
279
|
+
atd = pos >= 1 ? "<td colspan='" + pos + "'> </td>" : "";
|
|
280
|
+
if (!subGridFeedback.call(ts, "beforeExpand", subgridDivId, rowid)) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
$(tr).after("<tr role='row' class='" + rowClasses + "'>" + atd + "<td class='" + tdWithIconClasses +
|
|
284
|
+
"'><span class='" + iconClass("openicon") + "'></span></td><td colspan='" + parseInt(p.colNames.length - nhc, 10) +
|
|
285
|
+
"' class='" + tdDataClasses + "'><div id='" + subgridDivId + "' class='tablediv'></div></td></tr>");
|
|
286
|
+
$(ts).triggerHandler("jqGridSubGridRowExpanded", [subgridDivId, rowid]);
|
|
287
|
+
if ($.jgrid.isFunction(p.subGridRowExpanded)) {
|
|
288
|
+
p.subGridRowExpanded.call(ts, subgridDivId, rowid);
|
|
289
|
+
} else {
|
|
290
|
+
populatesubgrid(tr);
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
$(r).show();
|
|
294
|
+
}
|
|
295
|
+
$(this).html(
|
|
296
|
+
"<div class='" + base.getGuiStyles.call(ts, "subgrid.buttonDiv", "sgbutton-div") +
|
|
297
|
+
"'><a role='button' class='" + base.getGuiStyles.call(ts, "subgrid.button", "sgbutton") +
|
|
298
|
+
"'><span class='" + iconClass("minusicon") + "'></span></a></div>"
|
|
299
|
+
).removeClass("sgcollapsed").addClass("sgexpanded");
|
|
300
|
+
if (p.subGridOptions.selectOnExpand) {
|
|
301
|
+
$(ts).jqGrid("setSelection", rowid);
|
|
302
|
+
}
|
|
303
|
+
} else if ($(this).hasClass("sgexpanded")) {
|
|
304
|
+
if (!subGridFeedback.call(ts, "beforeCollapse", subgridDivId, rowid)) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (p.subGridOptions.reloadOnExpand === true) {
|
|
308
|
+
$(r).remove(".ui-subgrid");
|
|
309
|
+
} else if ($(r).hasClass("ui-subgrid")) { // incase of dynamic deleting
|
|
310
|
+
$(r).hide();
|
|
311
|
+
}
|
|
312
|
+
$(this).html(
|
|
313
|
+
"<div class='" + base.getGuiStyles.call(ts, "subgrid.buttonDiv", "sgbutton-div") +
|
|
314
|
+
"'><a role='button' class='" + base.getGuiStyles.call(ts, "subgrid.button", "sgbutton") +
|
|
315
|
+
"'><span class='" + iconClass("plusicon") + "'></span></a></div>"
|
|
316
|
+
).removeClass("sgexpanded").addClass("sgcollapsed");
|
|
317
|
+
if (p.subGridOptions.selectOnCollapse) {
|
|
318
|
+
$(ts).jqGrid("setSelection", rowid);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return false;
|
|
322
|
+
},
|
|
323
|
+
len,
|
|
324
|
+
tr1,
|
|
325
|
+
$td1,
|
|
326
|
+
iRow = 1;
|
|
327
|
+
|
|
328
|
+
if (!ts.grid) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
len = ts.rows.length;
|
|
333
|
+
if (sind !== undefined && sind > 0) {
|
|
334
|
+
iRow = sind;
|
|
335
|
+
len = sind + 1;
|
|
336
|
+
}
|
|
337
|
+
while (iRow < len) {
|
|
338
|
+
tr1 = ts.rows[iRow];
|
|
339
|
+
if ($(tr1).hasClass("jqgrow")) {
|
|
340
|
+
$td1 = $(tr1.cells[pos]);
|
|
341
|
+
if ($td1.hasClass("ui-sgcollapsed")) {
|
|
342
|
+
if (p.scroll) {
|
|
343
|
+
$td1.off("click");
|
|
344
|
+
}
|
|
345
|
+
$td1.on("click", onClick);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
iRow++;
|
|
349
|
+
}
|
|
350
|
+
if (p.subGridOptions.expandOnLoad === true) {
|
|
351
|
+
var iColSubgrid = p.iColByName.subgrid;
|
|
352
|
+
$(ts.rows).filter(".jqgrow").each(function (index, row) {
|
|
353
|
+
$(row.cells[iColSubgrid])
|
|
354
|
+
.filter(".sgcollapsed")
|
|
355
|
+
.children(".sgbutton-div")
|
|
356
|
+
.children(".sgbutton")
|
|
357
|
+
.click();
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
ts.subGridXml = function (xml, sid) {
|
|
361
|
+
return subGridXmlOrJson(xml, sid, fillXmlBody);
|
|
362
|
+
};
|
|
363
|
+
ts.subGridJson = function (json, sid) {
|
|
364
|
+
return subGridXmlOrJson(json, sid, fillJsonBody);
|
|
365
|
+
};
|
|
366
|
+
});
|
|
367
|
+
},
|
|
368
|
+
expandSubGridRow: function (rowid) {
|
|
369
|
+
return collapseOrExpand.call(this, rowid, "sgcollapsed");
|
|
370
|
+
},
|
|
371
|
+
collapseSubGridRow: function (rowid) {
|
|
372
|
+
return collapseOrExpand.call(this, rowid, "sgexpanded");
|
|
373
|
+
},
|
|
374
|
+
toggleSubGridRow: function (rowid) {
|
|
375
|
+
return collapseOrExpand.call(this, rowid, "ui-sgcollapsed");
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
// end module grid.subgrid
|
|
379
|
+
}));
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Transform a table to a jqGrid.
|
|
3
|
+
Peter Romianowski <peter.romianowski@optivo.de>
|
|
4
|
+
If the first column of the table contains checkboxes or
|
|
5
|
+
radiobuttons then the jqGrid is made selectable.
|
|
6
|
+
*/
|
|
7
|
+
/*jslint browser: true, plusplus: true, white: true */
|
|
8
|
+
/*global jQuery, define, exports, module, require */
|
|
9
|
+
// Addition - selector can be a class or id
|
|
10
|
+
(function (global, factory) {
|
|
11
|
+
"use strict";
|
|
12
|
+
if (typeof define === "function" && define.amd) {
|
|
13
|
+
// AMD. Register as an anonymous module.
|
|
14
|
+
define([
|
|
15
|
+
"jquery",
|
|
16
|
+
"./grid.base"
|
|
17
|
+
], function ($) {
|
|
18
|
+
return factory($, global);
|
|
19
|
+
});
|
|
20
|
+
} else if (typeof module === "object" && module.exports) {
|
|
21
|
+
// Node/CommonJS
|
|
22
|
+
module.exports = function (root, $) {
|
|
23
|
+
if (!root) {
|
|
24
|
+
root = window;
|
|
25
|
+
}
|
|
26
|
+
if ($ === undefined) {
|
|
27
|
+
// require("jquery") returns a factory that requires window to
|
|
28
|
+
// build a jQuery instance, we normalize how we use modules
|
|
29
|
+
// that require this pattern but the window provided is a noop
|
|
30
|
+
// if it's defined (how jquery works)
|
|
31
|
+
$ = typeof window !== "undefined" ?
|
|
32
|
+
require("jquery") :
|
|
33
|
+
require("jquery")(root);
|
|
34
|
+
}
|
|
35
|
+
require("./grid.base");
|
|
36
|
+
return factory($, root);
|
|
37
|
+
};
|
|
38
|
+
} else {
|
|
39
|
+
// Browser globals
|
|
40
|
+
factory(jQuery, global);
|
|
41
|
+
}
|
|
42
|
+
}(typeof window !== "undefined" ? window : this, function ($, window) {
|
|
43
|
+
"use strict";
|
|
44
|
+
// begin module grid.tbltogrid
|
|
45
|
+
window.tableToGrid = function (selector, options) {
|
|
46
|
+
$(selector).each(function () {
|
|
47
|
+
var self = this, $self = $(this), w, inputCheckbox, inputRadio, selectMultiple, selectSingle, selectable, a, id,
|
|
48
|
+
colModel = [], colNames = [], data = [], rowIds = [], rowChecked = [];
|
|
49
|
+
if (self.grid) {
|
|
50
|
+
return;//Adedd by Tony Tomov
|
|
51
|
+
}
|
|
52
|
+
// This is a small "hack" to make the width of the jqGrid 100%
|
|
53
|
+
$self.width("99%");
|
|
54
|
+
w = $self.width();
|
|
55
|
+
|
|
56
|
+
// Text whether we have single or multi select
|
|
57
|
+
inputCheckbox = $("tr td:first-child input[type=checkbox]:first", $self);
|
|
58
|
+
inputRadio = $("tr td:first-child input[type=radio]:first", $self);
|
|
59
|
+
selectMultiple = inputCheckbox.length > 0;
|
|
60
|
+
selectSingle = !selectMultiple && inputRadio.length > 0;
|
|
61
|
+
selectable = selectMultiple || selectSingle;
|
|
62
|
+
//var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");
|
|
63
|
+
|
|
64
|
+
// Build up the columnModel and the data
|
|
65
|
+
$("th", $self).each(function () {
|
|
66
|
+
if (colModel.length === 0 && selectable) {
|
|
67
|
+
colModel.push({
|
|
68
|
+
name: "__selection__",
|
|
69
|
+
index: "__selection__",
|
|
70
|
+
width: 0,
|
|
71
|
+
hidden: true
|
|
72
|
+
});
|
|
73
|
+
colNames.push("__selection__");
|
|
74
|
+
} else {
|
|
75
|
+
colModel.push({
|
|
76
|
+
name: $(this).attr("id") || $.jgrid.trim($.jgrid.stripHtml($(this).html())).split(" ").join("_"),
|
|
77
|
+
index: $(this).attr("id") || $.jgrid.trim($.jgrid.stripHtml($(this).html())).split(" ").join("_"),
|
|
78
|
+
width: $(this).width() || 150
|
|
79
|
+
});
|
|
80
|
+
colNames.push($(this).html());
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
$("tbody > tr", $self).each(function () {
|
|
84
|
+
var row = {}, rowPos = 0;
|
|
85
|
+
$("td", $(this)).each(function () {
|
|
86
|
+
if (rowPos === 0 && selectable) {
|
|
87
|
+
var input = $("input", $(this)), rowId = input.attr("value");
|
|
88
|
+
rowIds.push(rowId || data.length);
|
|
89
|
+
if (input.is(":checked")) {
|
|
90
|
+
rowChecked.push(rowId);
|
|
91
|
+
}
|
|
92
|
+
row[colModel[rowPos].name] = input.attr("value");
|
|
93
|
+
} else {
|
|
94
|
+
row[colModel[rowPos].name] = $(this).html();
|
|
95
|
+
}
|
|
96
|
+
rowPos++;
|
|
97
|
+
});
|
|
98
|
+
if (rowPos > 0) {
|
|
99
|
+
data.push(row);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Clear the original HTML table
|
|
104
|
+
$self.empty();
|
|
105
|
+
|
|
106
|
+
$self.jqGrid($.extend({
|
|
107
|
+
datatype: "local",
|
|
108
|
+
width: w,
|
|
109
|
+
colNames: colNames,
|
|
110
|
+
colModel: colModel,
|
|
111
|
+
multiselect: selectMultiple
|
|
112
|
+
//inputName: inputName,
|
|
113
|
+
//inputValueCol: imputName != null ? "__selection__" : null
|
|
114
|
+
}, options || {}));
|
|
115
|
+
|
|
116
|
+
// Add data
|
|
117
|
+
for (a = 0; a < data.length; a++) {
|
|
118
|
+
id = null;
|
|
119
|
+
if (rowIds.length > 0) {
|
|
120
|
+
id = rowIds[a];
|
|
121
|
+
if (id && id.replace) {
|
|
122
|
+
// We have to do this since the value of a checkbox
|
|
123
|
+
// or radio button can be anything
|
|
124
|
+
id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (id === null) {
|
|
128
|
+
id = $.jgrid.randId();
|
|
129
|
+
}
|
|
130
|
+
$self.jqGrid("addRowData", id, data[a]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Set the selection
|
|
134
|
+
for (a = 0; a < rowChecked.length; a++) {
|
|
135
|
+
$self.jqGrid("setSelection", rowChecked[a]);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
// end module grid.tbltogrid
|
|
140
|
+
return window.tableToGrid;
|
|
141
|
+
}));
|