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.
Files changed (211) hide show
  1. package/.tscache/all/hashes/free-jqgrid.d.ts-74303c8b076937117540c0cb798f2053 +1 -0
  2. package/.tscache/all/hashes/test.ts-0d81877a31bc5d7ac52dd35a66602f01 +1 -0
  3. package/.tscache/all/timestamp +0 -0
  4. package/dist/css/ui.jqgrid.css +1618 -0
  5. package/dist/css/ui.jqgrid.min.css +4 -0
  6. package/dist/css/ui.jqgrid.min.css.map +1 -0
  7. package/dist/i18n/grid.locale-ar.js +198 -0
  8. package/dist/i18n/grid.locale-bg.js +201 -0
  9. package/dist/i18n/grid.locale-bs.js +230 -0
  10. package/dist/i18n/grid.locale-ca.js +204 -0
  11. package/dist/i18n/grid.locale-cn.js +237 -0
  12. package/dist/i18n/grid.locale-cs.js +197 -0
  13. package/dist/i18n/grid.locale-da.js +196 -0
  14. package/dist/i18n/grid.locale-de.js +240 -0
  15. package/dist/i18n/grid.locale-el.js +195 -0
  16. package/dist/i18n/grid.locale-en.js +256 -0
  17. package/dist/i18n/grid.locale-es.js +202 -0
  18. package/dist/i18n/grid.locale-fa.js +211 -0
  19. package/dist/i18n/grid.locale-fi.js +201 -0
  20. package/dist/i18n/grid.locale-fr.js +197 -0
  21. package/dist/i18n/grid.locale-gl.js +197 -0
  22. package/dist/i18n/grid.locale-he.js +198 -0
  23. package/dist/i18n/grid.locale-hr.js +231 -0
  24. package/dist/i18n/grid.locale-hu.js +196 -0
  25. package/dist/i18n/grid.locale-id.js +238 -0
  26. package/dist/i18n/grid.locale-is.js +197 -0
  27. package/dist/i18n/grid.locale-it.js +189 -0
  28. package/dist/i18n/grid.locale-ja.js +203 -0
  29. package/dist/i18n/grid.locale-kr.js +194 -0
  30. package/dist/i18n/grid.locale-lt.js +199 -0
  31. package/dist/i18n/grid.locale-me.js +198 -0
  32. package/dist/i18n/grid.locale-nl.js +208 -0
  33. package/dist/i18n/grid.locale-no.js +180 -0
  34. package/dist/i18n/grid.locale-pl.js +204 -0
  35. package/dist/i18n/grid.locale-pt-br.js +210 -0
  36. package/dist/i18n/grid.locale-pt.js +196 -0
  37. package/dist/i18n/grid.locale-ro.js +210 -0
  38. package/dist/i18n/grid.locale-ru.js +196 -0
  39. package/dist/i18n/grid.locale-sk.js +198 -0
  40. package/dist/i18n/grid.locale-sl.js +230 -0
  41. package/dist/i18n/grid.locale-sr.js +199 -0
  42. package/dist/i18n/grid.locale-sv.js +198 -0
  43. package/dist/i18n/grid.locale-th.js +195 -0
  44. package/dist/i18n/grid.locale-tr.js +197 -0
  45. package/dist/i18n/grid.locale-tw.js +199 -0
  46. package/dist/i18n/grid.locale-ua.js +199 -0
  47. package/dist/i18n/grid.locale-vi.js +238 -0
  48. package/dist/i18n/min/grid.locale-ar.js +10 -0
  49. package/dist/i18n/min/grid.locale-ar.js.map +1 -0
  50. package/dist/i18n/min/grid.locale-bg.js +10 -0
  51. package/dist/i18n/min/grid.locale-bg.js.map +1 -0
  52. package/dist/i18n/min/grid.locale-ca.js +15 -0
  53. package/dist/i18n/min/grid.locale-ca.js.map +1 -0
  54. package/dist/i18n/min/grid.locale-cn.js +10 -0
  55. package/dist/i18n/min/grid.locale-cn.js.map +1 -0
  56. package/dist/i18n/min/grid.locale-cs.js +11 -0
  57. package/dist/i18n/min/grid.locale-cs.js.map +1 -0
  58. package/dist/i18n/min/grid.locale-da.js +10 -0
  59. package/dist/i18n/min/grid.locale-da.js.map +1 -0
  60. package/dist/i18n/min/grid.locale-de.js +21 -0
  61. package/dist/i18n/min/grid.locale-de.js.map +1 -0
  62. package/dist/i18n/min/grid.locale-el.js +10 -0
  63. package/dist/i18n/min/grid.locale-el.js.map +1 -0
  64. package/dist/i18n/min/grid.locale-en.js +11 -0
  65. package/dist/i18n/min/grid.locale-en.js.map +1 -0
  66. package/dist/i18n/min/grid.locale-es.js +16 -0
  67. package/dist/i18n/min/grid.locale-es.js.map +1 -0
  68. package/dist/i18n/min/grid.locale-fa.js +8 -0
  69. package/dist/i18n/min/grid.locale-fa.js.map +1 -0
  70. package/dist/i18n/min/grid.locale-fi.js +11 -0
  71. package/dist/i18n/min/grid.locale-fi.js.map +1 -0
  72. package/dist/i18n/min/grid.locale-fr.js +10 -0
  73. package/dist/i18n/min/grid.locale-fr.js.map +1 -0
  74. package/dist/i18n/min/grid.locale-gl.js +9 -0
  75. package/dist/i18n/min/grid.locale-gl.js.map +1 -0
  76. package/dist/i18n/min/grid.locale-he.js +10 -0
  77. package/dist/i18n/min/grid.locale-he.js.map +1 -0
  78. package/dist/i18n/min/grid.locale-hr.js +11 -0
  79. package/dist/i18n/min/grid.locale-hr.js.map +1 -0
  80. package/dist/i18n/min/grid.locale-hu.js +10 -0
  81. package/dist/i18n/min/grid.locale-hu.js.map +1 -0
  82. package/dist/i18n/min/grid.locale-id.js +10 -0
  83. package/dist/i18n/min/grid.locale-id.js.map +1 -0
  84. package/dist/i18n/min/grid.locale-is.js +9 -0
  85. package/dist/i18n/min/grid.locale-is.js.map +1 -0
  86. package/dist/i18n/min/grid.locale-it.js +2 -0
  87. package/dist/i18n/min/grid.locale-it.js.map +1 -0
  88. package/dist/i18n/min/grid.locale-ja.js +10 -0
  89. package/dist/i18n/min/grid.locale-ja.js.map +1 -0
  90. package/dist/i18n/min/grid.locale-kr.js +2 -0
  91. package/dist/i18n/min/grid.locale-kr.js.map +1 -0
  92. package/dist/i18n/min/grid.locale-lt.js +10 -0
  93. package/dist/i18n/min/grid.locale-lt.js.map +1 -0
  94. package/dist/i18n/min/grid.locale-me.js +10 -0
  95. package/dist/i18n/min/grid.locale-me.js.map +1 -0
  96. package/dist/i18n/min/grid.locale-nl.js +2 -0
  97. package/dist/i18n/min/grid.locale-nl.js.map +1 -0
  98. package/dist/i18n/min/grid.locale-no.js +2 -0
  99. package/dist/i18n/min/grid.locale-no.js.map +1 -0
  100. package/dist/i18n/min/grid.locale-pl.js +18 -0
  101. package/dist/i18n/min/grid.locale-pl.js.map +1 -0
  102. package/dist/i18n/min/grid.locale-pt-br.js +21 -0
  103. package/dist/i18n/min/grid.locale-pt-br.js.map +1 -0
  104. package/dist/i18n/min/grid.locale-pt.js +9 -0
  105. package/dist/i18n/min/grid.locale-pt.js.map +1 -0
  106. package/dist/i18n/min/grid.locale-ro.js +10 -0
  107. package/dist/i18n/min/grid.locale-ro.js.map +1 -0
  108. package/dist/i18n/min/grid.locale-ru.js +10 -0
  109. package/dist/i18n/min/grid.locale-ru.js.map +1 -0
  110. package/dist/i18n/min/grid.locale-sk.js +10 -0
  111. package/dist/i18n/min/grid.locale-sk.js.map +1 -0
  112. package/dist/i18n/min/grid.locale-sr.js +10 -0
  113. package/dist/i18n/min/grid.locale-sr.js.map +1 -0
  114. package/dist/i18n/min/grid.locale-sv.js +10 -0
  115. package/dist/i18n/min/grid.locale-sv.js.map +1 -0
  116. package/dist/i18n/min/grid.locale-th.js +10 -0
  117. package/dist/i18n/min/grid.locale-th.js.map +1 -0
  118. package/dist/i18n/min/grid.locale-tr.js +10 -0
  119. package/dist/i18n/min/grid.locale-tr.js.map +1 -0
  120. package/dist/i18n/min/grid.locale-tw.js +11 -0
  121. package/dist/i18n/min/grid.locale-tw.js.map +1 -0
  122. package/dist/i18n/min/grid.locale-ua.js +10 -0
  123. package/dist/i18n/min/grid.locale-ua.js.map +1 -0
  124. package/dist/i18n/min/grid.locale-vi.js +10 -0
  125. package/dist/i18n/min/grid.locale-vi.js.map +1 -0
  126. package/dist/jquery.jqgrid.min.js +11 -0
  127. package/dist/jquery.jqgrid.min.js.map +1 -0
  128. package/{js/jquery.jqgrid.src.js.1 → dist/jquery.jqgrid.src.js} +1 -1
  129. package/dist/modules/grid.base.js +8518 -0
  130. package/dist/modules/grid.celledit.js +673 -0
  131. package/dist/modules/grid.common.js +844 -0
  132. package/dist/modules/grid.custom.js +1795 -0
  133. package/dist/modules/grid.filter.js +897 -0
  134. package/dist/modules/grid.formedit.js +2537 -0
  135. package/dist/modules/grid.grouping.js +737 -0
  136. package/dist/modules/grid.import.js +251 -0
  137. package/dist/modules/grid.inlinedit.js +784 -0
  138. package/dist/modules/grid.jqueryui.js +965 -0
  139. package/dist/modules/grid.pivot.js +862 -0
  140. package/dist/modules/grid.subgrid.js +379 -0
  141. package/dist/modules/grid.tbltogrid.js +141 -0
  142. package/dist/modules/grid.treegrid.js +683 -0
  143. package/dist/modules/jqdnr.js +188 -0
  144. package/dist/modules/jqmodal.js +292 -0
  145. package/dist/modules/jquery.fmatter.js +1061 -0
  146. package/dist/modules/jsonxml.js +343 -0
  147. package/dist/modules/min/grid.base.js +11 -0
  148. package/dist/modules/min/grid.base.js.map +1 -0
  149. package/dist/modules/min/grid.celledit.js +2 -0
  150. package/dist/modules/min/grid.celledit.js.map +1 -0
  151. package/dist/modules/min/grid.common.js +2 -0
  152. package/dist/modules/min/grid.common.js.map +1 -0
  153. package/dist/modules/min/grid.custom.js +2 -0
  154. package/dist/modules/min/grid.custom.js.map +1 -0
  155. package/dist/modules/min/grid.filter.js +2 -0
  156. package/dist/modules/min/grid.filter.js.map +1 -0
  157. package/dist/modules/min/grid.formedit.js +2 -0
  158. package/dist/modules/min/grid.formedit.js.map +1 -0
  159. package/dist/modules/min/grid.grouping.js +2 -0
  160. package/dist/modules/min/grid.grouping.js.map +1 -0
  161. package/dist/modules/min/grid.import.js +2 -0
  162. package/dist/modules/min/grid.import.js.map +1 -0
  163. package/dist/modules/min/grid.inlinedit.js +2 -0
  164. package/dist/modules/min/grid.inlinedit.js.map +1 -0
  165. package/dist/modules/min/grid.jqueryui.js +2 -0
  166. package/dist/modules/min/grid.jqueryui.js.map +1 -0
  167. package/dist/modules/min/grid.pivot.js +2 -0
  168. package/dist/modules/min/grid.pivot.js.map +1 -0
  169. package/dist/modules/min/grid.subgrid.js +2 -0
  170. package/dist/modules/min/grid.subgrid.js.map +1 -0
  171. package/dist/modules/min/grid.tbltogrid.js +2 -0
  172. package/dist/modules/min/grid.tbltogrid.js.map +1 -0
  173. package/dist/modules/min/grid.treegrid.js +2 -0
  174. package/dist/modules/min/grid.treegrid.js.map +1 -0
  175. package/dist/modules/min/jqdnr.js +2 -0
  176. package/dist/modules/min/jqdnr.js.map +1 -0
  177. package/dist/modules/min/jqmodal.js +2 -0
  178. package/dist/modules/min/jqmodal.js.map +1 -0
  179. package/dist/modules/min/jquery.fmatter.js +2 -0
  180. package/dist/modules/min/jquery.fmatter.js.map +1 -0
  181. package/dist/modules/min/jsonxml.js +2 -0
  182. package/dist/modules/min/jsonxml.js.map +1 -0
  183. package/dist/plugins/css/ui.multiselect.css +30 -0
  184. package/dist/plugins/css/ui.multiselect.min.css +2 -0
  185. package/dist/plugins/css/ui.multiselect.min.css.map +1 -0
  186. package/dist/plugins/grid.odata.js +1313 -0
  187. package/dist/plugins/jqgrid_download.js +109 -0
  188. package/dist/plugins/jquery.contextmenu-ui.js +304 -0
  189. package/dist/plugins/jquery.contextmenu.js +174 -0
  190. package/dist/plugins/jquery.createcontexmenufromnavigatorbuttons.js +172 -0
  191. package/dist/plugins/jquery.jqgrid.showhidecolumnmenu.js +201 -0
  192. package/dist/plugins/min/grid.odata.js +11 -0
  193. package/dist/plugins/min/grid.odata.js.map +1 -0
  194. package/dist/plugins/min/jquery.contextmenu-ui.js +26 -0
  195. package/dist/plugins/min/jquery.contextmenu-ui.js.map +1 -0
  196. package/dist/plugins/min/jquery.contextmenu.js +19 -0
  197. package/dist/plugins/min/jquery.contextmenu.js.map +1 -0
  198. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js +12 -0
  199. package/dist/plugins/min/jquery.createcontexmenufromnavigatorbuttons.js.map +1 -0
  200. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js +10 -0
  201. package/dist/plugins/min/jquery.jqgrid.showhidecolumnmenu.js.map +1 -0
  202. package/dist/plugins/min/ui.multiselect.js +30 -0
  203. package/dist/plugins/min/ui.multiselect.js.map +1 -0
  204. package/dist/plugins/ui.multiselect.js +389 -0
  205. package/dist/ts/free-jqgrid.d.ts +2132 -0
  206. package/js/jquery.jqgrid.min.js +1 -1
  207. package/js/jquery.jqgrid.min.js.map +1 -1
  208. package/js/jquery.jqgrid.src.js +8 -3
  209. package/libre-jqgrid-4.17.4.tgz +0 -0
  210. package/package.json +1 -1
  211. package/.github/workflows/npm.yml +0 -47
@@ -0,0 +1,1795 @@
1
+ /**
2
+ * jqGrid extension for custom methods
3
+ * Tony Tomov tony@trirand.com, http://trirand.com/blog/
4
+ *
5
+ * Wildraid wildraid@mail.ru
6
+ * Oleg Kiriljuk oleg.kiriljuk@ok-soft-gmbh.com
7
+ * rany2, ranygh@riseup.net
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl-2.0.html
11
+ **/
12
+
13
+ /*jshint eqeqeq:false */
14
+ /*jslint browser: true, devel: true, eqeq: true, nomen: true, plusplus: true, vars: true, unparam: true, white: true, todo: true */
15
+ /*global jQuery, define, exports, module, require */
16
+ (function (global, factory) {
17
+ "use strict";
18
+ if (typeof define === "function" && define.amd) {
19
+ // AMD. Register as an anonymous module.
20
+ //console.log("grid.custom AMD");
21
+ define([
22
+ "jquery",
23
+ "./grid.base",
24
+ "./jquery.fmatter",
25
+ "./grid.common"
26
+ ], function ($) {
27
+ //console.log("grid.custom AMD: define callback");
28
+ return factory($, global.document);
29
+ });
30
+ } else if (typeof module === "object" && module.exports) {
31
+ // Node/CommonJS
32
+ //console.log("grid.custom CommonJS, typeof define=" + typeof define + ", define=" + define);
33
+ module.exports = function (root, $) {
34
+ //console.log("grid.custom CommonJS: in module.exports");
35
+ if (!root) {
36
+ root = window;
37
+ }
38
+ //console.log("grid.custom CommonJS: before require('jquery')");
39
+ if ($ === undefined) {
40
+ // require("jquery") returns a factory that requires window to
41
+ // build a jQuery instance, we normalize how we use modules
42
+ // that require this pattern but the window provided is a noop
43
+ // if it's defined (how jquery works)
44
+ $ = typeof window !== "undefined" ?
45
+ require("jquery") :
46
+ require("jquery")(root);
47
+ }
48
+ //console.log("grid.custom CommonJS: before require('./grid.base')");
49
+ require("./grid.base");
50
+ //console.log("grid.custom CommonJS: before require('./jquery.fmatter')");
51
+ require("./jquery.fmatter");
52
+ //console.log("grid.custom CommonJS: before require('./grid.common')");
53
+ require("./grid.common");
54
+ factory($, root.document);
55
+ return $;
56
+ };
57
+ } else {
58
+ // Browser globals
59
+ //console.log("grid.custom Browser: before factory");
60
+ factory(jQuery, global.document);
61
+ }
62
+ }(typeof window !== "undefined" ? window : this, function ($, document) {
63
+ "use strict";
64
+ var jgrid = $.jgrid, jqID = jgrid.jqID, base = $.fn.jqGrid,
65
+ getGuiStyles = base.getGuiStyles, getGridRes = base.getGridRes;
66
+
67
+ // begin module grid.custom
68
+ jgrid.extend({
69
+ getColProp: function (colname) {
70
+ var ret = {}, t = this[0], iCol;
71
+ if (t != null && t.grid) {
72
+ iCol = t.p.iColByName[colname];
73
+ if (iCol !== undefined) {
74
+ return t.p.colModel[iCol];
75
+ }
76
+ }
77
+ return ret;
78
+ },
79
+ setColProp: function (colname, obj) {
80
+ //do not set width will not work
81
+ return this.each(function () {
82
+ var self = this, p = self.p, iCol;
83
+ if (self.grid && p != null && obj) {
84
+ iCol = p.iColByName[colname];
85
+ if (iCol !== undefined) {
86
+ $.extend(true, p.colModel[iCol], obj);
87
+ }
88
+ }
89
+ });
90
+ },
91
+ sortGrid: function (colname, reload, sor) {
92
+ return this.each(function () {
93
+ var self = this, grid = self.grid, p = self.p, colModel = p.colModel, l = colModel.length, cm, i, sobj = false, sort;
94
+ if (!grid) { return; }
95
+ if (!colname) { colname = p.sortname; }
96
+ if (typeof reload !== "boolean") { reload = false; }
97
+ for (i = 0; i < l; i++) {
98
+ cm = colModel[i];
99
+ if (cm.index === colname || cm.name === colname) {
100
+ if (p.frozenColumns === true && cm.frozen === true) {
101
+ sobj = grid.fhDiv.find("#" + jqID(p.id + "_" + colname));
102
+ }
103
+ if (!sobj || sobj.length === 0) {
104
+ sobj = grid.headers[i].el;
105
+ }
106
+ sort = cm.sortable;
107
+ if (typeof sort !== "boolean" || sort) {
108
+ self.sortData(cm.index || cm.name, i, reload, sor, sobj);
109
+ }
110
+ break;
111
+ }
112
+ }
113
+ });
114
+ },
115
+ clearBeforeUnload: function () {
116
+ return this.each(function () {
117
+ var self = this, p = self.p, grid = self.grid, propOrMethod, clearArray = jgrid.clearArray,
118
+ hasOwnProperty = Object.prototype.hasOwnProperty;
119
+ if ($.jgrid.isFunction(grid.emptyRows)) {
120
+ grid.emptyRows.call(self, true, true); // this work quick enough and reduce the size of memory leaks if we have someone
121
+ }
122
+
123
+ $(document).off("mousemove.jqGrid mouseup.jqGrid" + p.id);
124
+ $(self).off();
125
+
126
+ /*grid.dragEnd = null;
127
+ grid.dragMove = null;
128
+ grid.dragStart = null;
129
+ grid.emptyRows = null;
130
+ grid.populate = null;
131
+ grid.populateVisible = null;
132
+ grid.scrollGrid = null;
133
+ grid.selectionPreserver = null;
134
+
135
+ grid.bDiv = null;
136
+ grid.fbRows = null;
137
+ grid.cDiv = null;
138
+ grid.hDiv = null;
139
+ grid.cols = null;*/
140
+ var i, l = grid.headers.length;
141
+ for (i = 0; i < l; i++) {
142
+ grid.headers[i].el = null;
143
+ }
144
+ for (propOrMethod in grid) {
145
+ if (grid.hasOwnProperty(propOrMethod)) {
146
+ grid.propOrMethod = null;
147
+ }
148
+ }
149
+
150
+ /*self.formatCol = null;
151
+ self.sortData = null;
152
+ self.updatepager = null;
153
+ self.refreshIndex = null;
154
+ self.setHeadCheckBox = null;
155
+ self.constructTr = null;
156
+ self.formatter = null;
157
+ self.addXmlData = null;
158
+ self.addJSONData = null;
159
+ self.grid = null;*/
160
+
161
+ var propOrMethods = ["formatCol", "sortData", "updatepager", "refreshIndex", "setHeadCheckBox", "constructTr", "clearToolbar", "fixScrollOffsetAndhBoxPadding", "rebuildRowIndexes", "modalAlert", "toggleToolbar", "triggerToolbar", "formatter", "addXmlData", "addJSONData", "ftoolbar", "_inlinenav", "nav", "grid", "p"];
162
+ l = propOrMethods.length;
163
+ for (i = 0; i < l; i++) {
164
+ if (hasOwnProperty.call(self, propOrMethods[i])) {
165
+ self[propOrMethods[i]] = null;
166
+ }
167
+ }
168
+ self._index = {};
169
+ clearArray(p.data);
170
+ clearArray(p.lastSelectedData);
171
+ clearArray(p.selarrrow);
172
+ clearArray(p.savedRow);
173
+ p.editingInfo = {};
174
+ });
175
+ },
176
+ GridDestroy: function () {
177
+ return this.each(function () {
178
+ var self = this, p = self.p;
179
+ if (self.grid && p != null) {
180
+ if (p.pager) { // if not part of grid
181
+ $(p.pager).remove();
182
+ }
183
+ try {
184
+ $("#alertmod_" + jqID(p.id)).remove();
185
+ $(self).jqGrid("clearBeforeUnload");
186
+ $(p.gBox).remove();
187
+ } catch (ignore) { }
188
+ }
189
+ });
190
+ },
191
+ GridUnload: function () {
192
+ return this.each(function () {
193
+ var self = this, $self = $(self), p = self.p, $j = $.fn.jqGrid;
194
+ if (!self.grid) { return; }
195
+ $self.removeClass($j.getGuiStyles.call($self, "grid", "ui-jqgrid-btable"));
196
+ // The multiple removeAttr can be replace to one after dropping of support of old jQuery
197
+ if (p.pager) {
198
+ if (p.pager.substr(1, $.jgrid.uidPref.length) === $.jgrid.uidPref) {
199
+ $(p.pager).remove();
200
+ } else {
201
+ $(p.pager).empty()
202
+ .removeClass($j.getGuiStyles.call($self, "pager.pager", "ui-jqgrid-pager " +
203
+ $j.getGuiStyles.call($self, "bottom")))
204
+ .removeAttr("style")
205
+ .removeAttr("dir");
206
+ }
207
+ }
208
+ $self.jqGrid("clearBeforeUnload");
209
+ $self.removeAttr("style")
210
+ .removeAttr("tabindex")
211
+ .removeAttr("role")
212
+ .removeAttr("aria-labelledby")
213
+ .removeAttr("style");
214
+ $self.empty(); // remove the first line
215
+ $self.insertBefore(p.gBox).show();
216
+ $(p.pager).insertBefore(p.gBox).show();
217
+ $(p.gBox).remove();
218
+ });
219
+ },
220
+ setGridState: function (state) {
221
+ return this.each(function () {
222
+ var $t = this, p = $t.p, grid = $t.grid, cDiv = grid.cDiv, $uDiv = $(grid.uDiv), $ubDiv = $(grid.ubDiv);
223
+ if (!grid || p == null) { return; }
224
+ var getMinimizeIcon = function (path) {
225
+ return base.getIconRes.call($t, "gridMinimize." + path);
226
+ },
227
+ visibleGridIcon = getMinimizeIcon("visible"),
228
+ hiddenGridIcon = getMinimizeIcon("hidden");
229
+ if (state === "hidden") {
230
+ $(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv", p.gView).slideUp("fast");
231
+ if (p.pager) { $(p.pager).slideUp("fast"); }
232
+ if (p.toppager) { $(p.toppager).slideUp("fast"); }
233
+ if (p.toolbar[0] === true) {
234
+ if (p.toolbar[1] === "both") {
235
+ $ubDiv.slideUp("fast");
236
+ }
237
+ $uDiv.slideUp("fast");
238
+ }
239
+ if (p.footerrow) { $(".ui-jqgrid-sdiv", p.gBox).slideUp("fast"); }
240
+ $(".ui-jqgrid-titlebar-close span", cDiv).removeClass(visibleGridIcon).addClass(hiddenGridIcon);
241
+ p.gridstate = "hidden";
242
+ } else if (state === "visible") {
243
+ $(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv", p.gView).slideDown("fast");
244
+ if (p.pager) { $(p.pager).slideDown("fast"); }
245
+ if (p.toppager) { $(p.toppager).slideDown("fast"); }
246
+ if (p.toolbar[0] === true) {
247
+ if (p.toolbar[1] === "both") {
248
+ $ubDiv.slideDown("fast");
249
+ }
250
+ $uDiv.slideDown("fast");
251
+ }
252
+ if (p.footerrow) { $(".ui-jqgrid-sdiv", p.gBox).slideDown("fast"); }
253
+ $(".ui-jqgrid-titlebar-close span", cDiv).removeClass(hiddenGridIcon).addClass(visibleGridIcon);
254
+ p.gridstate = "visible";
255
+ }
256
+ });
257
+ },
258
+ filterToolbar: function (oMuligrid) {
259
+ // if one uses jQuery wrapper with multiple grids, then oMultiple specify the object with common options
260
+ return this.each(function () {
261
+ var $t = this, grid = $t.grid, $self = $($t), p = $t.p, infoDialog = jgrid.info_dialog, htmlEncode = jgrid.htmlEncode;
262
+ if (this.ftoolbar) { return; }
263
+ // make new copy of the options and use it for ONE specific grid.
264
+ // p.searching can contains grid specific options
265
+ // we will don't modify the input options oMuligrid
266
+ var o = $.extend(true, {
267
+ autosearch: true,
268
+ autosearchDelay: 500,
269
+ searchOnEnter: true,
270
+ beforeSearch: null,
271
+ afterSearch: null,
272
+ beforeClear: null,
273
+ afterClear: null,
274
+ searchurl: "",
275
+ sField: "searchField",
276
+ sValue: "searchString",
277
+ sOper: "searchOper",
278
+ sFilter: p.prmNames.filters,
279
+ stringResult: false,
280
+ groupOp: "AND",
281
+ defaultSearch: "bw",
282
+ idMode: "new", // support "old", "compatibility", "new"
283
+ searchOperators: false,
284
+ resetIcon: "&times;",
285
+ applyLabelClasses: true,
286
+ loadFilterDefaults: true, // this options activates loading of default filters from grid's postData for Multipe Search only.
287
+ operands: { "eq": "==", "ne": "!", "lt": "<", "le": "<=", "gt": ">", "ge": ">=", "bw": "^", "bn": "!^", "in": "=", "ni": "!=", "ew": "|", "en": "!@", "cn": "~", "nc": "!~", "nu": "#", "nn": "!#" }
288
+ }, jgrid.search, p.searching || {}, oMuligrid || {}),
289
+ colModel = p.colModel,
290
+ getRes = function (path) {
291
+ return getGridRes.call($self, path);
292
+ },
293
+ errcap = getRes("errors.errcap"),
294
+ bClose = getRes("edit.bClose"),
295
+ editMsg = getRes("edit.msg"),
296
+ hoverClasses = getGuiStyles.call($t, "states.hover"),
297
+ highlightClass = getGuiStyles.call($t, "states.select"),
298
+ dataFieldClass = getGuiStyles.call($t, "filterToolbar.dataField"),
299
+ currentFilters = {},
300
+ getId = function (cmName) {
301
+ var prefix = "gs_";
302
+ switch (o.idMode) {
303
+ case "compatibility":
304
+ prefix += p.idPrefix;
305
+ break;
306
+ case "new":
307
+ prefix += p.id + "_";
308
+ break;
309
+ default: // "old"
310
+ break;
311
+ }
312
+ return prefix + cmName;
313
+ },
314
+ getIdSel = function (cmName) {
315
+ return "#" + jqID(getId(cmName));
316
+ },
317
+ getOnOffValue = function (soptions) {
318
+ var checkboxValue = (soptions.value || "").split(":");
319
+
320
+ return {
321
+ on: checkboxValue[0] || "on",
322
+ off: checkboxValue[1] || "off"
323
+ };
324
+ },
325
+ parseFilter = function (fillAll) {
326
+ var i, j, filters = p.postData[o.sFilter], filter = {}, rules, rule,
327
+ iColByName = p.iColByName, cm, soptions;
328
+ if (fillAll) {
329
+ for (j = 0; j < colModel.length; j++) {
330
+ cm = colModel[j];
331
+ if (cm.search !== false) {
332
+ soptions = cm.searchoptions || {};
333
+ filter[cm.name] = {
334
+ op: soptions.sopt ?
335
+ soptions.sopt[0] :
336
+ (cm.stype === "select" || cm.stype === "checkbox") ? "eq" : o.defaultSearch,
337
+ data: soptions.defaultValue !== undefined ? soptions.defaultValue : ""
338
+ };
339
+ }
340
+ }
341
+ }
342
+
343
+ // TODO: test for !o.stringResult && !o.searchOperators && p.datatype !== "local"
344
+ // and use p.postData[cm.index || cm.name] instead of filter[cm.name]
345
+ if (!filters || !p.search) { return filter; }
346
+ if (typeof filters === "string") {
347
+ try {
348
+ filters = JSON.parse(filters);
349
+ } catch (ignore) {
350
+ filters = {};
351
+ }
352
+ } else {
353
+ filters = filters || {};
354
+ }
355
+ rules = filters.rules || {};
356
+ if (filters == null ||
357
+ (filters.groupOp != null && o.groupOp != null && filters.groupOp.toUpperCase() !== o.groupOp.toUpperCase()) ||
358
+ rules == null || rules.length === 0 ||
359
+ (filters.groups != null && filters.groups.length > 0)) {
360
+ return filter;
361
+ }
362
+ for (j = 0; j < rules.length; j++) {
363
+ rule = rules[j];
364
+ // find all columns in colModel, where
365
+ // colModel[i].index || colModel[i].name === rule.field
366
+ cm = colModel[iColByName[rule.field]];
367
+ for (i = 0; i < colModel.length; i++) {
368
+ cm = colModel[i];
369
+ if ((cm.index || cm.name) !== rule.field || cm.search === false) {
370
+ continue;
371
+ }
372
+ soptions = cm.searchoptions || {};
373
+ if (soptions.sopt) {
374
+ if ($.inArray(rule.op, soptions.sopt) < 0) {
375
+ continue;
376
+ }
377
+ } else if (cm.stype === "select" || cm.stype === "checkbox") {
378
+ if (rule.op !== "eq") {
379
+ continue;
380
+ }
381
+ } else if (rule.op !== o.defaultSearch) {
382
+ continue;
383
+ }
384
+ filter[cm.name] = { op: rule.op, data: rule.data };
385
+ }
386
+ }
387
+ return filter;
388
+ },
389
+ setThreeStateCheckbox = function ($checkbox, state) {
390
+ switch (state) {
391
+ case 1: // make checked
392
+ $checkbox.data("state", 1)
393
+ .prop({
394
+ checked: true,
395
+ indeterminate: false
396
+ });
397
+ break;
398
+ case 0: // make unchecked
399
+ $checkbox.data("state", 0)
400
+ .prop({
401
+ checked: false,
402
+ indeterminate: false
403
+ });
404
+ break;
405
+ default: // make indeterminate
406
+ $checkbox.data("state", -1)
407
+ .prop({
408
+ checked: false,
409
+ indeterminate: true
410
+ });
411
+ break;
412
+ }
413
+ },
414
+ triggerToolbar = function () {
415
+ var sdata = {}, j = 0, sopt = {};
416
+ $.each(colModel, function () {
417
+ var cm = this, nm = cm.index || cm.name, v, so, searchoptions = cm.searchoptions || {},
418
+ $elem = $(getIdSel(cm.name), (cm.frozen === true && p.frozenColumns === true) ? grid.fhDiv : grid.hDiv),
419
+ getFormaterOption = function (optionName, formatter) {
420
+ var formatoptions = cm.formatoptions || {};
421
+ return formatoptions[optionName] !== undefined ?
422
+ formatoptions[optionName] :
423
+ getRes("formatter." + (formatter || cm.formatter) + "." + optionName);
424
+ },
425
+ cutThousandsSeparator = function (val) {
426
+ var separator = getFormaterOption("thousandsSeparator")
427
+ .replace(/([\.\*\_\'\(\)\{\}\+\?\\])/g, "\\$1");
428
+ return val.replace(new RegExp(separator, "g"), "");
429
+ };
430
+
431
+ if (o.searchOperators) {
432
+ so = $elem.parent().prev().children("a").data("soper") || o.defaultSearch;
433
+ } else {
434
+ so = searchoptions.sopt ? searchoptions.sopt[0] : (cm.stype === "select" || cm.stype === "checkbox") ? "eq" : o.defaultSearch;
435
+ }
436
+ /* the format of element of the searching toolbar if ANOTHER
437
+ * as the format of cells in the grid. So one can't use
438
+ * value = $.unformat.call($t, $elem, { colModel: cm }, iCol)
439
+ * to get the value. Even the access to the value should be
440
+ * $elem.val() instead of $elem.text() used in the common case of
441
+ * formatter. So we have to make manual conversion of searching filed
442
+ * used for integer/number/currency. The code will be duplicate */
443
+ if (cm.stype === "custom" && $.jgrid.isFunction(searchoptions.custom_value) && $elem.length > 0 && $elem[0].nodeName.toUpperCase() === "SPAN") {
444
+ v = searchoptions.custom_value.call($t, $elem.children(".customelement").first(), "get");
445
+ } else if (cm.stype === "select") {
446
+ if ($elem.prop("multiple")) {
447
+ v = $elem.val();
448
+ if (v == null || v.length === 0) {
449
+ v = "";
450
+ } else {
451
+ v = v.join(p.inFilterSeparator || ",");
452
+ }
453
+ } else {
454
+ v = $elem.val();
455
+ }
456
+ } else if (cm.stype === "checkbox") {
457
+ var onOffValue = getOnOffValue(searchoptions);
458
+
459
+ switch ($elem.data("state")) {
460
+ case -1: // has indeterminate state
461
+ v = "";
462
+ break;
463
+ case 0: // is unchecked
464
+ // make indeterminate
465
+ v = onOffValue.off;
466
+ break;
467
+ default: // is checked
468
+ // make unchecked
469
+ v = onOffValue.on;
470
+ break;
471
+ }
472
+ } else {
473
+ v = $.jgrid.trim($elem.val());
474
+ switch (cm.formatter) {
475
+ case "integer":
476
+ v = cutThousandsSeparator(v)
477
+ .replace(getFormaterOption("decimalSeparator", "number"), ".");
478
+ if (v !== "") {
479
+ // normalize the strings like "010.01" to "10"
480
+ v = String(parseInt(v, 10));
481
+ }
482
+ break;
483
+ case "number":
484
+ v = cutThousandsSeparator(v)
485
+ .replace(getFormaterOption("decimalSeparator"), ".");
486
+ if (v !== "" && String(v).charAt(0) === "0") {
487
+ // normalize the strings like "010.00" to "10"
488
+ // and "010.12" to "10.12"
489
+ v = String(parseFloat(v));
490
+ }
491
+ break;
492
+ case "currency":
493
+ var prefix = getFormaterOption("prefix"),
494
+ suffix = getFormaterOption("suffix");
495
+ if (prefix && prefix.length && v.substr(0, prefix.length) === prefix) {
496
+ v = v.substr(prefix.length);
497
+ }
498
+ if (suffix && suffix.length && v.length > suffix.length && v.substr(v.length - suffix.length, suffix.length) === suffix) {
499
+ v = v.substr(0, v.length - suffix.length);
500
+ }
501
+ v = cutThousandsSeparator(v)
502
+ .replace(getFormaterOption("decimalSeparator"), ".");
503
+ if (v !== "") {
504
+ // normalize the strings like "010.00" to "10"
505
+ // and "010.12" to "10.12"
506
+ v = String(parseFloat(v));
507
+ }
508
+ break;
509
+ default:
510
+ // TODO: call unformatter if it's defined.
511
+ break;
512
+ }
513
+ }
514
+ if (v || so === "nu" || so === "nn" || $.inArray(so, p.customUnaryOperations) >= 0) {
515
+ sdata[nm] = v;
516
+ sopt[nm] = so;
517
+ j++;
518
+ } else {
519
+ if (sdata.hasOwnProperty(nm)) {
520
+ delete sdata[nm];
521
+ }
522
+ if (!(o.stringResult || o.searchOperators || p.datatype === "local")) {
523
+ try {
524
+ if (p.postData != null && p.postData.hasOwnProperty(nm)) {
525
+ delete p.postData[nm];
526
+ }
527
+ } catch (ignore) { }
528
+ }
529
+ }
530
+ });
531
+ var sd = j > 0 ? true : false;
532
+ if (o.stringResult || o.searchOperators || p.datatype === "local") {
533
+ var ruleGroup = '{"groupOp":"' + o.groupOp + '","rules":[';
534
+ var gi = 0;
535
+ $.each(sdata, function (cmName, n) {
536
+ //var iCol = p.iColByName[cmName], cm = p.colModel[iCol],
537
+ // value = $.unformat.call($t, $("<span></span>").text(n), { colModel: cm }, iCol);
538
+ if (gi > 0) { ruleGroup += ","; }
539
+ ruleGroup += '{"field":"' + cmName + '",';
540
+ ruleGroup += '"op":"' + sopt[cmName] + '",';
541
+ n += "";
542
+ ruleGroup += '"data":"' + n.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
543
+ gi++;
544
+ });
545
+ ruleGroup += "]}";
546
+ p.postData[o.sFilter] = ruleGroup;
547
+ $.each([o.sField, o.sValue, o.sOper], function (i, n) {
548
+ if (p.postData.hasOwnProperty(n)) { delete p.postData[n]; }
549
+ });
550
+ } else {
551
+ $.extend(p.postData, sdata);
552
+ }
553
+ var saveurl;
554
+ if (p.searchurl) {
555
+ saveurl = p.url;
556
+ $self.jqGrid("setGridParam", { url: p.searchurl });
557
+ }
558
+ var bsr = $self.triggerHandler("jqGridToolbarBeforeSearch") === "stop" ? true : false;
559
+ if (!bsr && $.jgrid.isFunction(o.beforeSearch)) { bsr = o.beforeSearch.call($t); }
560
+ if (!bsr) {
561
+ $self.jqGrid("setGridParam", { search: sd })
562
+ .trigger("reloadGrid", [$.extend({ page: 1 }, o.reloadGridSearchOptions || {})]);
563
+ }
564
+ if (saveurl) { $self.jqGrid("setGridParam", { url: saveurl }); }
565
+ $self.triggerHandler("jqGridToolbarAfterSearch");
566
+ if ($.jgrid.isFunction(o.afterSearch)) { o.afterSearch.call($t); }
567
+ },
568
+ clearToolbar = function (trigger) {
569
+ var sdata = {}, j = 0, nm;
570
+ trigger = (typeof trigger !== "boolean") ? true : trigger;
571
+ $.each(colModel, function () {
572
+ var v, cm = this, $elem = $(getIdSel(cm.name), (cm.frozen === true && p.frozenColumns === true) ? grid.fhDiv : grid.hDiv),
573
+ isSindleSelect, searchoptions = cm.searchoptions || {};
574
+ if (searchoptions.defaultValue !== undefined) { v = searchoptions.defaultValue; }
575
+ nm = cm.index || cm.name;
576
+ switch (cm.stype) {
577
+ case "checkbox":
578
+ // set indeterminate state
579
+ setThreeStateCheckbox($elem, -1);
580
+ break;
581
+ case "select":
582
+ isSindleSelect = $elem.length > 0 ? !$elem[0].multiple : true;
583
+ $elem.find("option").each(function (i) {
584
+ this.selected = i === 0 && isSindleSelect;
585
+ if ($(this).val() === v) {
586
+ this.selected = true;
587
+ return false;
588
+ }
589
+ });
590
+ if (v !== undefined) {
591
+ // post the key and not the text
592
+ sdata[nm] = v;
593
+ j++;
594
+ } else {
595
+ try {
596
+ delete p.postData[nm];
597
+ } catch (ignore) { }
598
+ }
599
+ break;
600
+ case "text":
601
+ $elem.val(v || "");
602
+ if (v !== undefined) {
603
+ sdata[nm] = v;
604
+ j++;
605
+ } else {
606
+ try {
607
+ delete p.postData[nm];
608
+ } catch (ignore) { }
609
+ }
610
+ break;
611
+ case "custom":
612
+ if ($.jgrid.isFunction(searchoptions.custom_value) && $elem.length > 0 && $elem[0].nodeName.toUpperCase() === "SPAN") {
613
+ if (v === undefined) {
614
+ v = "";
615
+ }
616
+ searchoptions.custom_value.call($t, $elem.children(".customelement").first(), "set", v);
617
+ }
618
+ break;
619
+ }
620
+ });
621
+ var sd = j > 0 ? true : false;
622
+ p.resetsearch = true;
623
+ if (o.stringResult || o.searchOperators || p.datatype === "local") {
624
+ var ruleGroup = '{"groupOp":"' + o.groupOp + '","rules":[';
625
+ var gi = 0;
626
+ $.each(sdata, function (i, n) {
627
+ if (gi > 0) { ruleGroup += ","; }
628
+ ruleGroup += '{"field":"' + i + '",';
629
+ ruleGroup += '"op":"' + "eq" + '",';
630
+ n += "";
631
+ ruleGroup += '"data":"' + n.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
632
+ gi++;
633
+ });
634
+ ruleGroup += "]}";
635
+ p.postData[o.sFilter] = ruleGroup;
636
+ $.each([o.sField, o.sValue, o.sOper], function (i, n) {
637
+ if (p.postData.hasOwnProperty(n)) { delete p.postData[n]; }
638
+ });
639
+ } else {
640
+ $.extend(p.postData, sdata);
641
+ }
642
+ var saveurl;
643
+ if (p.searchurl) {
644
+ saveurl = p.url;
645
+ $self.jqGrid("setGridParam", { url: p.searchurl });
646
+ }
647
+ var bcv = $self.triggerHandler("jqGridToolbarBeforeClear") === "stop" ? true : false;
648
+ if (!bcv && $.jgrid.isFunction(o.beforeClear)) { bcv = o.beforeClear.call($t); }
649
+ if (!bcv) {
650
+ if (trigger) {
651
+ $self.jqGrid("setGridParam", { search: sd })
652
+ .trigger("reloadGrid", [$.extend({ page: 1 }, o.reloadGridResetOptions || {})]);
653
+ }
654
+ }
655
+ if (saveurl) { $self.jqGrid("setGridParam", { url: saveurl }); }
656
+ $self.triggerHandler("jqGridToolbarAfterClear");
657
+ if ($.jgrid.isFunction(o.afterClear)) { o.afterClear.call($t); }
658
+ },
659
+ toggleToolbar = function () {
660
+ var trow = $("tr.ui-search-toolbar", grid.hDiv),
661
+ trow2 = p.frozenColumns === true ? $("tr.ui-search-toolbar", grid.fhDiv) : false;
662
+ if (trow.css("display") === "none") {
663
+ trow.show();
664
+ if (trow2) {
665
+ trow2.show();
666
+ }
667
+ } else {
668
+ trow.hide();
669
+ if (trow2) {
670
+ trow2.hide();
671
+ }
672
+ }
673
+ if (p.frozenColumns === true) {
674
+ $self.jqGrid("destroyFrozenColumns");
675
+ $self.jqGrid("setFrozenColumns");
676
+ }
677
+ },
678
+ odata = getRes("search.odata") || [],
679
+ customSortOperations = p.customSortOperations,
680
+ buildRuleMenu = function (elem, left, top) {
681
+ $("#sopt_menu").remove();
682
+
683
+ left = parseInt(left, 10);
684
+ top = parseInt(top, 10) + 18;
685
+
686
+ var selclass, ina, i = 0, aoprs = [], selected = $(elem).data("soper"), nm = $(elem).data("colname"),
687
+ fs = $(".ui-jqgrid-view").css("font-size") || "11px",
688
+ str = "<ul id='sopt_menu' class='" +
689
+ getGuiStyles.call($t, "searchToolbar.menu", "ui-search-menu") +
690
+ "' role='menu' tabindex='0' style='z-index:9999;display:block;font-size:" + fs + ";left:" + left + "px;top:" + top + "px;'>";
691
+ i = p.iColByName[nm];
692
+ if (i === undefined) { return; }
693
+ var cm = colModel[i], options = $.extend({}, cm.searchoptions), odataItem, item, itemOper, itemOperand, itemText;
694
+ if (!options.sopt) {
695
+ options.sopt = [];
696
+ options.sopt[0] = (cm.stype === "select" || cm.stype === "checkbox") ? "eq" : o.defaultSearch;
697
+ }
698
+ $.each(odata, function () { aoprs.push(this.oper); });
699
+ // append aoprs array with custom operations defined in customSortOperations parameter jqGrid
700
+ if (customSortOperations != null) {
701
+ $.each(customSortOperations, function (propertyName) { aoprs.push(propertyName); });
702
+ }
703
+ for (i = 0; i < options.sopt.length; i++) {
704
+ itemOper = options.sopt[i];
705
+ ina = $.inArray(itemOper, aoprs);
706
+ if (ina !== -1) {
707
+ odataItem = odata[ina];
708
+ if (odataItem !== undefined) {
709
+ // standard operation
710
+ itemOperand = o.operands[itemOper];
711
+ itemText = odataItem.text;
712
+ } else if (customSortOperations != null) {
713
+ // custom operation
714
+ item = customSortOperations[itemOper];
715
+ itemOperand = item.operand;
716
+ itemText = item.text;
717
+ }
718
+ selclass = selected === itemOper ? highlightClass : "";
719
+ str += '<li class="' +
720
+ getGuiStyles.call($t, "searchToolbar.menuItem", "ui-jqgrid-menu-item " + selclass) +
721
+ '" role="presentation"><a class="' +
722
+ getGuiStyles.call($t, "searchToolbar.menuItemButton", "g-menu-item") +
723
+ '" tabindex="0" role="menuitem" value="' + htmlEncode(itemOper) + '" data-oper="' + htmlEncode(itemOperand) + '"><table><tr><td style="width:25px">' + htmlEncode(itemOperand) + '</td><td>' + htmlEncode(itemText) + '</td></tr></table></a></li>';
724
+ }
725
+ }
726
+ str += "</ul>";
727
+ $("body").append(str);
728
+ $("#sopt_menu > li > a").hover(
729
+ function () { $(this).addClass(hoverClasses); },
730
+ function () { $(this).removeClass(hoverClasses); }
731
+ ).click(function () {
732
+ var v = $(this).attr("value"),
733
+ oper = $(this).data("oper");
734
+ $self.triggerHandler("jqGridToolbarSelectOper", [v, oper, elem]);
735
+ $("#sopt_menu").hide();
736
+ $(elem).data("soper", v).text(oper);
737
+ if (o.autosearch === true) {
738
+ var inpelm = $(elem).parent().next().children()[0];
739
+ if ($(inpelm).val() || v === "nu" || v === "nn" || $.inArray(v, p.customUnaryOperations) >= 0) {
740
+ triggerToolbar();
741
+ }
742
+ }
743
+ });
744
+ },
745
+ timeoutHnd,
746
+ bindings = [],
747
+ $tr = $("<tr></tr>", { "class": "ui-search-toolbar", role: "row form" });
748
+
749
+ if (o.loadFilterDefaults) {
750
+ currentFilters = parseFilter() || {};
751
+ }
752
+ // create the row
753
+ $.each(colModel, function (ci) {
754
+ var cm = this, soptions, mode = "filter", surl, sot, so, i, searchoptions = cm.searchoptions || {}, editoptions = cm.editoptions || {},
755
+ $th = $("<th></th>", {
756
+ "class": getGuiStyles.call($t, "colHeaders", "ui-th-column ui-th-" + p.direction + " " + (o.applyLabelClasses ? cm.labelClasses || "" : "")),
757
+ role: "gridcell",
758
+ "aria-describedby": p.id + "_" + cm.name
759
+ }),
760
+ $thd = $("<div></div>"), elem, $elem,
761
+ $stable = $("<table class='ui-search-table'><tbody><tr><td class='ui-search-oper'></td><td class='ui-search-input'></td><td class='ui-search-clear' style='width:1px'></td></tr></tbody></table>"),
762
+ $tds = $stable.children("tbody").children("tr").children("td"),
763
+ $tdOper = $tds.eq(0),
764
+ $tdInput = $tds.eq(1),
765
+ $tdClear = $tds.eq(2);
766
+ if (this.hidden === true) { $th.css("display", "none"); }
767
+ this.search = this.search === false ? false : true;
768
+ if (this.stype === undefined) { this.stype = "text"; }
769
+ soptions = $.extend({ mode: mode, name: cm.name, cm: cm, iCol: ci, id: getId(cm.name) }, searchoptions);
770
+ if (this.search) {
771
+ if (o.searchOperators) {
772
+ if (p.search && currentFilters[this.name] != null) {
773
+ so = currentFilters[this.name].op;
774
+ } else {
775
+ so = (soptions.sopt) ? soptions.sopt[0] : (cm.stype === "select" || cm.stype === "checkbox") ? "eq" : o.defaultSearch;
776
+ }
777
+ for (i = 0; i < odata.length; i++) {
778
+ if (odata[i].oper === so) {
779
+ sot = o.operands[so] || "";
780
+ break;
781
+ }
782
+ }
783
+ if (sot === undefined && customSortOperations != null) {
784
+ var customOp;
785
+ for (customOp in customSortOperations) {
786
+ if (customSortOperations.hasOwnProperty(customOp) && customOp === so) {
787
+ sot = customSortOperations[customOp].operand;
788
+ break;
789
+ //soptions.searchtitle = customSortOperations[customOp].title;
790
+ }
791
+ }
792
+ }
793
+ if (sot === undefined) { sot = "="; }
794
+ $tdOper.append("<a title='" +
795
+ (soptions.searchtitle != null ? soptions.searchtitle : getRes("search.operandTitle")) +
796
+ "' data-soper='" + so + "' class='" +
797
+ getGuiStyles.call($t, "searchToolbar.operButton", "soptclass") +
798
+ "' data-colname='" + this.name + "'>" + htmlEncode(sot) + "</a>");
799
+ }
800
+ $tdOper.data("colindex", ci);
801
+ if (soptions.sopt == null || soptions.sopt.length === 1) {
802
+ $tdOper.hide();
803
+ }
804
+ if (p.search && currentFilters[this.name] != null) {
805
+ soptions.defaultValue = currentFilters[this.name].data;
806
+ }
807
+ if (soptions.clearSearch === undefined) {
808
+ soptions.clearSearch = this.stype === "text" ? true : false;
809
+ }
810
+ if (soptions.clearSearch) {
811
+ var csv = $.jgrid.isFunction(o.resetTitle) ?
812
+ o.resetTitle.call($t, {
813
+ options: o,
814
+ cm: cm,
815
+ cmName: cm.name,
816
+ iCol: ci
817
+ }) :
818
+ (getRes("search.resetTitle") || "Clear Search Value") + " " + jgrid.stripHtml(p.colNames[ci]);
819
+ $tdClear.append("<a title='" + csv + "' aria-label='" + csv + "' class='" +
820
+ getGuiStyles.call($t, "searchToolbar.clearButton", "clearsearchclass") +
821
+ "'><span>" + o.resetIcon + "</span></a>");
822
+ } else {
823
+ $tdClear.hide();
824
+ }
825
+ $thd.append($stable);
826
+ switch (this.stype) {
827
+ case "checkbox":
828
+ var state = soptions.defaultValue !== undefined ? soptions.defaultValue : "-1";
829
+ $elem = $("<input role='search' type='checkbox' class='" + dataFieldClass +
830
+ "' name='" + (cm.index || cm.name) +
831
+ "' id='" + getId(cm.name) +
832
+ "' aria-labelledby='" + "jqgh_" + p.id + "_" + cm.name +
833
+ "' data-state='" + state + "'/>");
834
+ if (state === "-1") {
835
+ $elem.prop("indeterminate", true);
836
+ } else if (state === "1") {
837
+ $elem.prop("checked", true);
838
+ }
839
+ $elem.click(function () {
840
+ var $checkbox = $(this);
841
+ switch ($checkbox.data("state")) {
842
+ case -1: // has indeterminate state
843
+ // make checked
844
+ setThreeStateCheckbox($checkbox, 1);
845
+ break;
846
+ case 0: // is unchecked
847
+ // set indeterminate state
848
+ setThreeStateCheckbox($checkbox, -1);
849
+ break;
850
+ default: // is checked
851
+ // make unchecked
852
+ setThreeStateCheckbox($checkbox, 0);
853
+ break;
854
+ }
855
+ if (o.autosearch === true) {
856
+ triggerToolbar();
857
+ }
858
+ });
859
+ $tdInput.append($elem);
860
+ if (soptions.attr) { $elem.attr(soptions.attr); }
861
+ bindings.push({ elem: $elem[0], options: soptions }); break;
862
+ case "select":
863
+ surl = this.surl || soptions.dataUrl;
864
+ if (surl) {
865
+ // data returned should have already constructed html select
866
+ // primitive jQuery load
867
+ $.ajax($.extend({
868
+ url: surl,
869
+ context: { $tdInput: $tdInput, options: soptions, cm: cm, iCol: ci },
870
+ dataType: "html",
871
+ success: function (data, textStatus, jqXHR) {
872
+ var cm1 = this.cm, iCol1 = this.iCol, soptions1 = this.options, d, ov1,
873
+ $td = this.$tdInput, $select;
874
+ if (soptions1.buildSelect !== undefined) {
875
+ d = soptions1.buildSelect.call($t, data, jqXHR, cm1, iCol1);
876
+ if (d) {
877
+ $td.append(d);
878
+ }
879
+ } else {
880
+ $td.append(data);
881
+ }
882
+ $select = $td.children("select");
883
+ $select.attr({ name: cm1.index || cm1.name, id: getId(cm1.name) });
884
+ if (soptions1.attr) { $select.attr(soptions1.attr); }
885
+ $select.addClass(dataFieldClass);
886
+ $select.css({ width: "100%" });
887
+ if ($select.find("option[value='']").length === 0 && typeof soptions.noFilterText === "string") {
888
+ ov1 = document.createElement("option");
889
+ ov1.value = "";
890
+ ov1.innerHTML = soptions.noFilterText;
891
+ $select.prepend(ov1);
892
+ if ($($select[0].options[$select[0].selectedIndex]).attr("selected") == null && !$select[0].multiple) {
893
+ $select[0].selectedIndex = 0;
894
+ }
895
+ }
896
+ if ($select[0].multiple && $select.find("option[selected]").length === 0 && $select[0].selectedIndex !== -1) {
897
+ // It can be that multiselect (select with multiple attribute) will be returned from surl
898
+ // or build with respect of buildSelect WITHOUT having multiple attribute
899
+ // (just as <select>...</select> instead of <select multiple="multiple">...</select>)
900
+ // and the multiple attribute will be assigned via soptions.attr (attr: { multiple: "multiple" }).
901
+ // One will have non-multiple select initially, where the first element will be automatically selected.
902
+ // After assigning the attribute multiple="multiple" the select will be able to have no selected elements,
903
+ // but it will be too late. To fix the case we will unselect the first element in the special case.
904
+ $select[0].options[$select[0].selectedIndex].selected = false;
905
+ }
906
+
907
+ if (soptions1.defaultValue !== undefined) { $select.val(soptions1.defaultValue); }
908
+ // preserve autoserch
909
+ jgrid.bindEv.call($t, $select[0], soptions1);
910
+ jgrid.fullBoolFeedback.call($t, soptions1.selectFilled, "jqGridSelectFilled", {
911
+ elem: $select[0],
912
+ options: soptions1,
913
+ cm: cm1,
914
+ cmName: cm1.name,
915
+ iCol: iCol1,
916
+ mode: mode
917
+ });
918
+ if (o.autosearch === true) {
919
+ $select.change(function () {
920
+ triggerToolbar();
921
+ return false;
922
+ });
923
+ }
924
+ }
925
+ }, jgrid.ajaxOptions, p.ajaxSelectOptions || {}));
926
+ } else {
927
+ var oSv, sep, delim;
928
+ if (cm.searchoptions) {
929
+ oSv = searchoptions.value === undefined ? editoptions.value || "" : searchoptions.value;
930
+ sep = searchoptions.separator === undefined ? editoptions.separator || ":" : searchoptions.separator;
931
+ delim = searchoptions.delimiter === undefined ? editoptions.delimiter || ";" : searchoptions.delimiter;
932
+ } else if (cm.editoptions) {
933
+ oSv = editoptions.value === undefined ? "" : editoptions.value;
934
+ sep = editoptions.separator === undefined ? ":" : editoptions.separator;
935
+ delim = editoptions.delimiter === undefined ? ";" : editoptions.delimiter;
936
+ }
937
+ if (searchoptions.generateValue && p.indexByColumnData[cm.name] != null) {
938
+ oSv = $t.generateValueFromColumnIndex(cm.name, sep, delim);
939
+ }
940
+ if (oSv) {
941
+ elem = document.createElement("select");
942
+ elem.style.width = "100%";
943
+ $elem = $(elem).attr({
944
+ name: cm.index || cm.name,
945
+ role: "search",
946
+ id: getId(cm.name),
947
+ "aria-describedby": p.id + "_" + cm.name
948
+ });
949
+ if (soptions.attr) { $elem.attr(soptions.attr); }
950
+ var isNoFilterValueExist = jgrid.fillSelectOptions(
951
+ elem,
952
+ oSv,
953
+ sep,
954
+ delim,
955
+ soptions.attr != null && soptions.attr.multiple
956
+ );
957
+ if (!isNoFilterValueExist && typeof soptions.noFilterText === "string") {
958
+ var ov = document.createElement("option");
959
+ ov.value = "";
960
+ ov.innerHTML = soptions.noFilterText;
961
+ ov.selected = true;
962
+ $elem.prepend(ov);
963
+ }
964
+ if (soptions.defaultValue !== undefined) { $elem.val(soptions.defaultValue); }
965
+ $elem.addClass(dataFieldClass);
966
+ //bindEv.call($t, elem, soptions);
967
+ bindings.push({ elem: elem, options: soptions });
968
+ $tdInput.append(elem);
969
+ jgrid.fullBoolFeedback.call($t, soptions.selectFilled, "jqGridSelectFilled", {
970
+ elem: elem,
971
+ options: cm.searchoptions || editoptions,
972
+ cm: cm,
973
+ cmName: cm.name,
974
+ iCol: ci,
975
+ mode: mode
976
+ });
977
+ if (o.autosearch === true) {
978
+ $elem.change(function () {
979
+ triggerToolbar();
980
+ return false;
981
+ });
982
+ }
983
+ }
984
+ }
985
+ break;
986
+ case "text":
987
+ $elem = $("<input role='search' type='text' class='" + dataFieldClass +
988
+ "' name='" + (cm.index || cm.name) +
989
+ "' id='" + getId(cm.name) +
990
+ "' aria-labelledby='" + "jqgh_" + p.id + "_" + cm.name +
991
+ "' value='" + (soptions.defaultValue !== undefined ? soptions.defaultValue : "") + "'/>");
992
+
993
+ $tdInput.append($elem);
994
+ if (cm.createColumnIndex && soptions.generateDatalist) {
995
+ var dataListId = "dl_" + getId(cm.name),
996
+ $datalist = $self.jqGrid("generateDatalistFromColumnIndex", cm.name);
997
+ if ($datalist != null && $datalist.length > 0) {
998
+ $elem.attr("list", dataListId);
999
+ $tdInput.append($datalist.attr("id", dataListId));
1000
+ }
1001
+ }
1002
+ if (soptions.attr) { $elem.attr(soptions.attr); }
1003
+ bindings.push({ elem: $elem[0], options: soptions });
1004
+ if (o.autosearch === true) {
1005
+ if (o.searchOnEnter) {
1006
+ $elem.keypress(function (e) {
1007
+ var key1 = e.charCode || e.keyCode || 0;
1008
+ if (key1 === 13) {
1009
+ triggerToolbar();
1010
+ return false;
1011
+ }
1012
+ return this;
1013
+ });
1014
+ } else {
1015
+ $elem.keydown(function (e) {
1016
+ var key1 = e.which;
1017
+ switch (key1) {
1018
+ case 13:
1019
+ return false;
1020
+ case 9:
1021
+ case 16:
1022
+ case 37:
1023
+ case 38:
1024
+ case 39:
1025
+ case 40:
1026
+ case 27:
1027
+ break;
1028
+ default:
1029
+ if (timeoutHnd) { clearTimeout(timeoutHnd); }
1030
+ timeoutHnd = setTimeout(function () { triggerToolbar(); }, o.autosearchDelay);
1031
+ }
1032
+ });
1033
+ }
1034
+ }
1035
+ break;
1036
+ case "custom":
1037
+ $tdInput.append("<span style='width:100%;padding:0;box-sizing:border-box;' name='" + (cm.index || cm.name) + "' id='" + getId(cm.name) + "'/>");
1038
+ try {
1039
+ if ($.jgrid.isFunction(soptions.custom_element)) {
1040
+ var celm = soptions.custom_element.call($t, soptions.defaultValue !== undefined ? soptions.defaultValue : "", soptions);
1041
+ if (celm) {
1042
+ celm = $(celm).addClass("customelement");
1043
+ $thd.find("span[name='" + (cm.index || cm.name) + "']").append(celm);
1044
+ } else {
1045
+ throw "e2";
1046
+ }
1047
+ } else {
1048
+ throw "e1";
1049
+ }
1050
+ } catch (ex) {
1051
+ if (ex === "e1") {
1052
+ infoDialog.call($t, errcap, "function 'custom_element' " + editMsg.nodefined, bClose);
1053
+ }
1054
+ if (ex === "e2") {
1055
+ infoDialog.call($t, errcap, "function 'custom_element' " + editMsg.novalue, bClose);
1056
+ } else {
1057
+ infoDialog.call($t, errcap, typeof ex === "string" ? ex : ex.message, bClose);
1058
+ }
1059
+ }
1060
+ break;
1061
+ }
1062
+ }
1063
+ $th.append($thd);
1064
+ $th.find(".ui-search-oper .soptclass,.ui-search-clear .clearsearchclass")
1065
+ .hover(function () {
1066
+ $(this).addClass(hoverClasses);
1067
+ }, function () {
1068
+ $(this).removeClass(hoverClasses);
1069
+ });
1070
+ $tr.append($th);
1071
+ if (!o.searchOperators) {
1072
+ $tdOper.hide();
1073
+ }
1074
+ });
1075
+ $(grid.hDiv).find(">div>.ui-jqgrid-htable>thead").append($tr);
1076
+ $.each(bindings, function () {
1077
+ jgrid.bindEv.call($t, this.elem, this.options);
1078
+ });
1079
+ if (o.searchOperators) {
1080
+ $(".soptclass", $tr).click(function (e) {
1081
+ var offset = $(this).offset(),
1082
+ left = (offset.left),
1083
+ top = (offset.top);
1084
+ buildRuleMenu(this, left, top);
1085
+ e.stopPropagation();
1086
+ });
1087
+ $("body").on("click", function (e) {
1088
+ if (e.target.className !== "soptclass") {
1089
+ $("#sopt_menu").hide();
1090
+ }
1091
+ });
1092
+ }
1093
+ $(".clearsearchclass", $tr).click(function () {
1094
+ var $tdOper = $(this).closest(".ui-search-clear"),
1095
+ $tdSearchOper = $tdOper.siblings(".ui-search-oper"),
1096
+ $oper = $tdSearchOper.children("a"),
1097
+ soper = $oper.data("soper"), v, operText,
1098
+ coli = parseInt($tdSearchOper.data("colindex"), 10),
1099
+ $tdInput = $tdOper.siblings(".ui-search-input"),
1100
+ cm = colModel[coli],
1101
+ sval = $.extend({}, cm.searchoptions || {}),
1102
+ dval = sval.defaultValue || "";
1103
+ switch (cm.stype) {
1104
+ case "select":
1105
+ if (dval) {
1106
+ $tdInput.find("select").val(dval);
1107
+ } else {
1108
+ $tdInput.find("select")[0].selectedIndex = 0;
1109
+ }
1110
+ break;
1111
+ case "checkbox":
1112
+ // set indeterminate state
1113
+ setThreeStateCheckbox($tdInput.find("input[type=checkbox]"), -1);
1114
+ break;
1115
+ default:
1116
+ $tdInput.find("input").val(dval);
1117
+ break;
1118
+ }
1119
+
1120
+ if (soper === "nu" || soper === "nn" || $.inArray(soper, p.customUnaryOperations) >= 0) {
1121
+ // one need reset an unary operation to default search operation
1122
+ v = sval.sopt ?
1123
+ sval.sopt[0] :
1124
+ (cm.stype === "select" || cm.stype === "checkbox") ?
1125
+ "eq" :
1126
+ o.defaultSearch;
1127
+
1128
+ operText = customSortOperations != null && customSortOperations[v] != null ?
1129
+ customSortOperations[v].operand :
1130
+ o.operands[v] || "";
1131
+
1132
+ $oper.data("soper", v).text(operText);
1133
+ }
1134
+
1135
+ // ToDo custom search type
1136
+ if (o.autosearch === true) {
1137
+ triggerToolbar();
1138
+ }
1139
+
1140
+ });
1141
+ $t.ftoolbar = true;
1142
+ $t.triggerToolbar = triggerToolbar;
1143
+ $t.clearToolbar = clearToolbar;
1144
+ $t.toggleToolbar = toggleToolbar;
1145
+ if (p.frozenColumns === true) {
1146
+ $self.jqGrid("destroyFrozenColumns");
1147
+ $self.jqGrid("setFrozenColumns");
1148
+ }
1149
+ $self.on(
1150
+ "jqGridRefreshFilterValues.filterToolbar" + (o.loadFilterDefaults ? " jqGridAfterLoadComplete.filterToolbar" : ""),
1151
+ function () {
1152
+ var cmName, filter, newFilters = parseFilter(true) || {}, $input, $searchOper, i, $th, searchoptions;
1153
+ if (!o.stringResult && !o.searchOperators && p.datatype !== "local" && p.search) {
1154
+ return; // do nothing on legacy searching
1155
+ }
1156
+
1157
+ for (cmName in newFilters) {
1158
+ if (newFilters.hasOwnProperty(cmName)) {
1159
+ filter = newFilters[cmName];
1160
+ $input = $(getIdSel(cmName));
1161
+ $th = $input.closest("th.ui-th-column");
1162
+ if ($input.length > 0 && $th.length > 0) {
1163
+ searchoptions = (p.colModel[$th[0].cellIndex] || {}).searchoptions || {};
1164
+ if ($input[0].tagName.toUpperCase() === "SELECT" && $input[0].multiple) {
1165
+ $input.val(filter.data.split(p.inFilterSeparator || ","));
1166
+ } else if ($input.is("input[type=checkbox]")) {
1167
+ var onOffValue = getOnOffValue(searchoptions);
1168
+ setThreeStateCheckbox(
1169
+ $input,
1170
+ filter.data === onOffValue.on ?
1171
+ 1 :
1172
+ (filter.data === onOffValue.off ? 0 : -1)
1173
+ );
1174
+ } else if ($input.find(".customelement").length > 0 && $.jgrid.isFunction(searchoptions.custom_value)) {
1175
+ var oldValue = searchoptions.custom_value.call($t, $input.find(".customelement").first(), "get");
1176
+ if (filter.data === "" && searchoptions.defaultValue !== undefined) {
1177
+ filter.data = searchoptions.defaultValue;
1178
+ }
1179
+ if (oldValue === undefined) {
1180
+ oldValue = "";
1181
+ }
1182
+ if (filter.data !== oldValue && String(filter.data) !== String(oldValue)) {
1183
+ searchoptions.custom_value.call($t, $input.find(".customelement").first(), "set", filter.data);
1184
+ }
1185
+ } else {
1186
+ if (filter.data === "" && searchoptions.defaultValue !== undefined) {
1187
+ filter.data = searchoptions.defaultValue;
1188
+ }
1189
+ if ($.jgrid.trim($input.val()) !== String(filter.data)) {
1190
+ $input.val(filter.data);
1191
+ }
1192
+ }
1193
+ $searchOper = $input.closest(".ui-search-input")
1194
+ .siblings(".ui-search-oper")
1195
+ .children(".soptclass");
1196
+ $searchOper.data("soper", filter.op);
1197
+ $searchOper.text(o.operands[filter.op] || (p.customSortOperations[filter.op] || {}).operand);
1198
+ }
1199
+ }
1200
+ }
1201
+ for (i = 0; i < p.colModel.length; i++) {
1202
+ cmName = p.colModel[i].name;
1203
+ if (!newFilters.hasOwnProperty(cmName)) {
1204
+ $(getIdSel(cmName)).val("");
1205
+ }
1206
+ }
1207
+ }
1208
+ );
1209
+ });
1210
+ },
1211
+ destroyFilterToolbar: function () {
1212
+ return this.each(function () {
1213
+ var self = this;
1214
+ if (!self.ftoolbar) {
1215
+ return;
1216
+ }
1217
+ self.triggerToolbar = null;
1218
+ self.clearToolbar = null;
1219
+ self.toggleToolbar = null;
1220
+ self.ftoolbar = false;
1221
+ $(self.grid.hDiv).find("table thead tr.ui-search-toolbar").remove();
1222
+ if (self.p.frozenColumns === true) {
1223
+ $(self).jqGrid("destroyFrozenColumns")
1224
+ .jqGrid("setFrozenColumns");
1225
+ }
1226
+ });
1227
+ },
1228
+ destroyGroupHeader: function (nullHeader) {
1229
+ if (nullHeader === undefined) {
1230
+ nullHeader = true;
1231
+ }
1232
+ return this.each(function () {
1233
+ var $t = this, i, l, $th, $resizing, grid = $t.grid, cm = $t.p.colModel, hc,
1234
+ thead = $("table.ui-jqgrid-htable thead", grid.hDiv);
1235
+ if (!grid) { return; }
1236
+ delete this.grid.groupHeaders;
1237
+
1238
+ $($t).off(".setGroupHeaders");
1239
+ var $tr = $("<tr>", { role: "row" }).addClass("ui-jqgrid-labels");
1240
+ var headers = grid.headers;
1241
+ for (i = 0, l = headers.length; i < l; i++) {
1242
+ hc = cm[i].hidden ? "none" : "";
1243
+ $th = $(headers[i].el)
1244
+ .width(headers[i].width)
1245
+ .css("display", hc);
1246
+ try {
1247
+ $th.removeAttr("rowSpan");
1248
+ } catch (rs) {
1249
+ //IE 6/7
1250
+ $th.attr("rowSpan", 1);
1251
+ }
1252
+ $tr.append($th);
1253
+ $resizing = $th.children("span.ui-jqgrid-resize");
1254
+ if ($resizing.length > 0) {// resizable column
1255
+ $resizing[0].style.height = "";
1256
+ }
1257
+ $th.children("div")[0].style.top = "";
1258
+ }
1259
+ $(thead).children("tr.ui-jqgrid-labels").remove();
1260
+ $(thead).prepend($tr);
1261
+
1262
+ if (nullHeader === true) {
1263
+ $($t).jqGrid("setGridParam", { "groupHeader": null });
1264
+ }
1265
+ });
1266
+ },
1267
+ setGroupHeaders: function (o) {
1268
+ o = $.extend({
1269
+ useColSpanStyle: false,
1270
+ applyLabelClasses: true,
1271
+ groupHeaders: []
1272
+ }, o || {});
1273
+ return this.each(function () {
1274
+ this.p.groupHeader = o;
1275
+ var ts = this, i, cmi, skip = 0, $tr, $colHeader, th, $th, thStyle, iCol, cghi, numberOfColumns, titleText, cVisibleColumns,
1276
+ p = ts.p, colModel = p.colModel, cml = colModel.length, ths = ts.grid.headers, $theadInTable, thClasses,
1277
+ $htable = $("table.ui-jqgrid-htable", ts.grid.hDiv), isCellClassHidden = jgrid.isCellClassHidden,
1278
+ $trLabels = $htable.children("thead").children("tr.ui-jqgrid-labels"),
1279
+ $trLastWithLabels = $trLabels.last().addClass("jqg-second-row-header"),
1280
+ $thead = $htable.children("thead"),
1281
+ $firstHeaderRow = $htable.find(".jqg-first-row-header");
1282
+ if ($firstHeaderRow[0] === undefined) {
1283
+ $firstHeaderRow = $("<tr>", { role: "row", "aria-hidden": "true" }).addClass("jqg-first-row-header").css("height", "auto");
1284
+ } else {
1285
+ $firstHeaderRow.empty();
1286
+ }
1287
+ var inColumnHeader = function (cmName, columnHeaders) {
1288
+ var j;
1289
+ for (j = 0; j < columnHeaders.length; j++) {
1290
+ if (columnHeaders[j].startColumnName === cmName) {
1291
+ return columnHeaders[j];
1292
+ }
1293
+ }
1294
+ return 0; // falsy value
1295
+ };
1296
+
1297
+ $(ts).prepend($thead);
1298
+ $tr = $("<tr>", { role: "row" }).addClass("ui-jqgrid-labels jqg-third-row-header");
1299
+ this.grid.groupHeaders = [];
1300
+ for (i = 0; i < cml; i++) {
1301
+ th = ths[i].el;
1302
+ $th = $(th);
1303
+ cmi = colModel[i];
1304
+ // build the next cell for the first header row
1305
+ // ??? cmi.hidden || isCellClassHidden(cmi.classes) || $th.is(":hidden")
1306
+ thStyle = { height: "0", width: ths[i].width + "px", display: (cmi.hidden ? "none" : "") };
1307
+ $("<th>", { role: "gridcell" }).css(thStyle).addClass("ui-first-th-" + p.direction + (o.applyLabelClasses ? " " + (cmi.labelClasses || "") : "")).appendTo($firstHeaderRow);
1308
+
1309
+ th.style.width = ""; // remove unneeded style
1310
+ thClasses = getGuiStyles.call(ts, "colHeaders", "ui-th-column-header ui-th-" + p.direction + " " + (o.applyLabelClasses ? cmi.labelClasses || "" : ""));
1311
+ cghi = inColumnHeader(cmi.name, o.groupHeaders);
1312
+ if (cghi) {
1313
+ numberOfColumns = cghi.numberOfColumns;
1314
+ titleText = cghi.titleText;
1315
+
1316
+ // caclulate the number of visible columns from the next numberOfColumns columns
1317
+ for (cVisibleColumns = 0, iCol = 0; iCol < numberOfColumns && (i + iCol < cml); iCol++) {
1318
+ if (!colModel[i + iCol].hidden && !isCellClassHidden(colModel[i + iCol].classes)) {
1319
+ cVisibleColumns++;
1320
+ }
1321
+ }
1322
+
1323
+ // The next numberOfColumns headers will be moved in the next row
1324
+ // in the current row will be placed the new column header with the titleText.
1325
+ // The text will be over the cVisibleColumns columns
1326
+ $colHeader = $("<th>")
1327
+ .addClass(thClasses)
1328
+ .addClass(cghi.className)
1329
+ .html(titleText || "&nbsp;");
1330
+ if (cVisibleColumns > 0) {
1331
+ $colHeader.attr("colspan", String(cVisibleColumns));
1332
+ }
1333
+ if (p.headertitles) {
1334
+ $colHeader.attr("title", $colHeader.text());
1335
+ }
1336
+ // hide if not a visible cols
1337
+ if (cVisibleColumns === 0) {
1338
+ $colHeader.hide();
1339
+ }
1340
+
1341
+ $th.before($colHeader); // insert new column header before the current
1342
+ $tr.append(th); // move the current header in the next row
1343
+ this.grid.groupHeaders.push({
1344
+ el: $colHeader[0],
1345
+ numberOfColumns: cghi.numberOfColumns,
1346
+ numberOfVisibleColumns: cVisibleColumns,
1347
+ title: cghi.titleText
1348
+ });
1349
+
1350
+ // set the counter of headers which will be moved in the next row
1351
+ skip = numberOfColumns - 1;
1352
+ } else {
1353
+ if (skip === 0) {
1354
+ if (o.useColSpanStyle) {
1355
+ // expand the header height to two rows
1356
+ $th.attr("rowspan", $trLabels.length + 1); // consider to use ($th.attr("rowspan") || 1) instead of $trLabels.length
1357
+ } else {
1358
+ $("<th>")
1359
+ .addClass(thClasses)
1360
+ .css({ "display": cmi.hidden ? "none" : "", "border-top": "0 none" })
1361
+ .insertBefore($th);
1362
+ $tr.append(th);
1363
+ }
1364
+ } else {
1365
+ // move the header to the next row
1366
+ $tr.append(th);
1367
+ skip--;
1368
+ }
1369
+ this.grid.groupHeaders.push({
1370
+ el: th,
1371
+ numberOfColumns: 1,
1372
+ numberOfVisibleColumns: 0,
1373
+ title: ''
1374
+ });
1375
+ }
1376
+ }
1377
+ $theadInTable = $(ts).children("thead");
1378
+ $theadInTable.prepend($firstHeaderRow);
1379
+ $tr.insertAfter($trLastWithLabels);
1380
+ $htable.prepend($theadInTable);
1381
+
1382
+ $(ts).triggerHandler("jqGridAfterSetGroupHeaders");
1383
+ });
1384
+ },
1385
+ getNumberOfFrozenColumns: function () {
1386
+ var $t = this;
1387
+ if ($t.length === 0) {
1388
+ return 0;
1389
+ }
1390
+ $t = $t[0];
1391
+ var colModel = $t.p.colModel, len = colModel.length, maxfrozen = -1, i;
1392
+ // get the max index of frozen col
1393
+ for (i = 0; i < len; i++) {
1394
+ // from left, no breaking frozen
1395
+ if (colModel[i].frozen !== true) {
1396
+ break;
1397
+ }
1398
+ maxfrozen = i;
1399
+ }
1400
+ return maxfrozen + 1;
1401
+ },
1402
+ setFrozenColumns: function (o) {
1403
+ o = o || {};
1404
+ return this.each(function () {
1405
+ var $t = this, $self = $($t), p = $t.p, grid = $t.grid;
1406
+ if (!grid || p == null || p.frozenColumns === true) { return; }
1407
+ var cm = p.colModel, i, len = cm.length, maxfrozen = -1, frozen = false, frozenIds = [], $colHeaderRow,// nonFrozenIds = [],
1408
+ tid = jqID(p.id), // one can use p.idSel and remove "#"
1409
+ hoverClasses = getGuiStyles.call($t, "states.hover");
1410
+
1411
+ // TODO treeGrid and grouping Support
1412
+ // TODO: allow to edit columns AFTER frozen columns
1413
+ if (p.subGrid === true || p.treeGrid === true || p.scroll) {
1414
+ return;
1415
+ }
1416
+
1417
+ // get the max index of frozen col
1418
+ for (i = 0; i < len; i++) {
1419
+ // from left, no breaking frozen
1420
+ if (cm[i].frozen !== true) {
1421
+ break;
1422
+ //nonFrozenIds.push("#jqgh_" + tid + "_" + jqID(cm[i].name));
1423
+ }
1424
+ frozen = true;
1425
+ maxfrozen = i;
1426
+ frozenIds.push("#jqgh_" + tid + "_" + jqID(cm[i].name));
1427
+ }
1428
+ if (p.sortable) {
1429
+ $colHeaderRow = $(grid.hDiv).find(".ui-jqgrid-htable .ui-jqgrid-labels");
1430
+ try {
1431
+ $colHeaderRow.sortable("destroy");
1432
+ } catch (ignore) { }
1433
+ $self.jqGrid("setGridParam", {
1434
+ sortable: {
1435
+ options: {
1436
+ items: frozenIds.length > 0 ?
1437
+ ">th:not(:has(" + frozenIds.join(",") + "),:hidden)" :
1438
+ ">th:not(:hidden)"
1439
+ }
1440
+ }
1441
+ });
1442
+ $self.jqGrid("sortableColumns", $colHeaderRow);
1443
+ }
1444
+ if (maxfrozen >= 0 && frozen) {
1445
+ var top = p.caption ? $(grid.cDiv).outerHeight() : 0,
1446
+ hth = $(".ui-jqgrid-htable", p.gView).height();
1447
+ //headers
1448
+ if (p.toppager) {
1449
+ top = top + $(grid.topDiv).outerHeight();
1450
+ }
1451
+ if (p.toolbar[0] === true) {
1452
+ if (p.toolbar[1] !== "bottom") {
1453
+ top = top + $(grid.uDiv).outerHeight();
1454
+ }
1455
+ }
1456
+ grid.fhDiv = $("<div style='position:absolute;overflow:hidden;" +
1457
+ (p.direction === "rtl" ? "right:0;border-top-left-radius:0;" : "left:0;border-top-right-radius:0;") +
1458
+ "top:" + top + "px;height:" + hth +
1459
+ "px;' class='" + getGuiStyles.call($t, "hDiv", "frozen-div ui-jqgrid-hdiv") + "'></div>");
1460
+ grid.fbDiv = $("<div style='position:absolute;overflow:hidden;" +
1461
+ (p.direction === "rtl" ? "right:0;" : "left:0;") +
1462
+ "top:" + (parseInt(top, 10) + parseInt(hth, 10) + 1) +
1463
+ "px;overflow:hidden;' class='frozen-bdiv ui-jqgrid-bdiv'></div>");
1464
+ $(p.gView).append(grid.fhDiv);
1465
+ var htbl = $(".ui-jqgrid-htable", p.gView).clone(true),
1466
+ tHeadRows = htbl[0].tHead.rows;
1467
+ // groupheader support - only if useColSpanstyle is false
1468
+ if (p.groupHeader) {
1469
+ // TODO: remove all th which corresponds non-frozen columns. One can identify there by id
1470
+ // for example. Consider to use name attribute of th on column headers. It simplifies
1471
+ // identifying of the columns.
1472
+ $(tHeadRows[0].cells).filter(":gt(" + maxfrozen + ")").remove();
1473
+ $(tHeadRows).filter(".jqg-third-row-header").each(function () {
1474
+ $(this).children("th[id]")
1475
+ .each(function () {
1476
+ var id = $(this).attr("id"), colName;
1477
+ if (id && id.substr(0, $t.id.length + 1) === $t.id + "_") {
1478
+ colName = id.substr($t.id.length + 1);
1479
+ if (p.iColByName[colName] > maxfrozen) {
1480
+ $(this).remove();
1481
+ }
1482
+ }
1483
+ });
1484
+ });
1485
+ var swapfroz = -1, fdel = -1, cs, rs;
1486
+ // TODO: test carefully processing of hidden columns
1487
+ $(tHeadRows).filter(".jqg-second-row-header").children("th").each(function () {
1488
+ cs = parseInt($(this).attr("colspan") || 1, 10);
1489
+ rs = parseInt($(this).attr("rowspan") || 1, 10);
1490
+ if (rs > 1) {
1491
+ swapfroz++;
1492
+ fdel++;
1493
+ } else if (cs) {
1494
+ swapfroz = swapfroz + cs;
1495
+ fdel++;
1496
+ }
1497
+ if (swapfroz === maxfrozen) {
1498
+ return false;
1499
+ }
1500
+ });
1501
+ if (swapfroz !== maxfrozen) {
1502
+ fdel = maxfrozen;
1503
+ }
1504
+ $(tHeadRows).filter(".jqg-second-row-header,.ui-search-toolbar").each(function () {
1505
+ $(this).children(":gt(" + fdel + ")").remove();
1506
+ });
1507
+ } else {
1508
+ $(tHeadRows).each(function () {
1509
+ $(this).children(":gt(" + maxfrozen + ")").remove();
1510
+ });
1511
+ }
1512
+ // htable, bdiv and ftable uses table-layout:fixed; style
1513
+ // to make it working one have to set ANY width value on table.
1514
+ // The value of the width will be ignored, the sum of widths
1515
+ // of the first column will be used as the width of tables
1516
+ // and all columns will have the same width like the first row.
1517
+ // We set below just width=1 of the tables.
1518
+ $(htbl).width(1);
1519
+ // resizing stuff
1520
+ $(grid.fhDiv).append(htbl)
1521
+ .scroll(function () {
1522
+ // the fhDiv can be scrolled because of tab keyboard navigation
1523
+ // we prevent horizontal scrolling of fhDiv
1524
+ this.scrollLeft = 0;
1525
+ });
1526
+ if (p.footerrow) {
1527
+ var hbd = $(".ui-jqgrid-bdiv", p.gView).height();
1528
+
1529
+ grid.fsDiv = $("<div style='position:absolute;" + (p.direction === "rtl" ? "right:0;" : "left:0;") + "top:" + (parseInt(top, 10) + parseInt(hth, 10) + parseInt(hbd, 10) + 1) + "px;' class='frozen-sdiv ui-jqgrid-sdiv'></div>");
1530
+ $(p.gView).append(grid.fsDiv);
1531
+ var ftbl = $(".ui-jqgrid-ftable", p.gView).clone(true);
1532
+ $("tr", ftbl).each(function () {
1533
+ $("td:gt(" + maxfrozen + ")", this).remove();
1534
+ });
1535
+ $(ftbl).width(1);
1536
+ $(grid.fsDiv).append(ftbl);
1537
+ }
1538
+
1539
+ // data stuff
1540
+ //TODO support for setRowData
1541
+ $(p.gView).append(grid.fbDiv);
1542
+ $(grid.bDiv).scroll(function () {
1543
+ $(grid.fbDiv).scrollTop($(this).scrollTop());
1544
+ });
1545
+ $(grid.fbDiv).on("mousewheel.setFrozenColumns DOMMouseScroll.setFrozenColumns", function (e) {
1546
+ grid.bDiv.scrollTop += $.jgrid.isFunction(o.mouseWheel) ?
1547
+ o.mouseWheel.call($t, e) :
1548
+ e.type === "mousewheel" ?
1549
+ -e.originalEvent.wheelDelta / 10 :
1550
+ e.originalEvent.detail * 6;
1551
+ });
1552
+ if (p.hoverrows === true) {
1553
+ $(p.idSel).off("mouseover.jqGrid mouseout.jqGrid");
1554
+ }
1555
+ var safeHeightSet = function ($elem, newHeight) {
1556
+ var height = $elem.height();
1557
+ if (Math.abs(height - newHeight) >= 1 && newHeight > 0) {
1558
+ $elem.height(newHeight);
1559
+ height = $elem.height();
1560
+ if (Math.abs(newHeight - height) >= 1) {
1561
+ $elem.height(newHeight + Math.round((newHeight - height)));
1562
+ }
1563
+ }
1564
+ },
1565
+ safeWidthSet = function ($elem, newWidth) {
1566
+ var width = $elem.width();
1567
+ if (Math.abs(width - newWidth) >= 1) {
1568
+ $elem.width(newWidth);
1569
+ width = $elem.width();
1570
+ if (Math.abs(newWidth - width) >= 1) {
1571
+ $elem.width(newWidth + Math.round((newWidth - width)));
1572
+ }
1573
+ }
1574
+ },
1575
+ fixDiv = function ($hDiv, hDivBase, iRowStart, iRowEnd) {
1576
+ var iRow, n, $frozenRows, $rows, $row, $frozenRow, posFrozenTop, height, newHeightFrozen, td,
1577
+ posTop = $(hDivBase).position().top, frozenTableTop, tableTop, cells;
1578
+ if ($hDiv != null && $hDiv.length > 0) {
1579
+ $hDiv[0].scrollTop = hDivBase.scrollTop;
1580
+ $hDiv.css(p.direction === "rtl" ?
1581
+ { top: posTop, right: 0 } :
1582
+ { top: posTop, left: 0 }
1583
+ );
1584
+ // first try with thead for the hdiv
1585
+ $frozenRows = $hDiv.children("table").children("thead").children("tr");
1586
+ $rows = $(hDivBase).children("div").children("table").children("thead").children("tr");
1587
+ if ($rows.length === 0 && $hDiv.children("table").length > 0) {
1588
+ // then use tbody for bdiv
1589
+ $frozenRows = $($hDiv.children("table")[0].rows);
1590
+ $rows = $($(hDivBase).children("div").children("table")[0].rows);
1591
+ }
1592
+ n = Math.min($frozenRows.length, $rows.length);
1593
+ frozenTableTop = n > 0 ? $($frozenRows[0]).position().top : 0;
1594
+ tableTop = n > 0 ? $($rows[0]).position().top : 0; // typically 0
1595
+ if (iRowStart >= 0) { // negative iRowStart means no changing of the height of individual rows
1596
+ if (iRowEnd >= 0) { // negative iRowEnd means all rows
1597
+ n = Math.min(iRowEnd + 1, n);
1598
+ }
1599
+ for (iRow = iRowStart; iRow < n; iRow++) {
1600
+ // but after that one have to verify all scenarios
1601
+ $row = $($rows[iRow]);
1602
+ if ($row.css("display") !== "none" && $row.is(":visible")) {
1603
+ posTop = $row.position().top;
1604
+ $frozenRow = $($frozenRows[iRow]);
1605
+ posFrozenTop = $frozenRow.position().top;
1606
+ height = $row.height();
1607
+ if (p.groupHeader != null && p.groupHeader.useColSpanStyle) {
1608
+ cells = $row[0].cells;
1609
+ for (i = 0; i < cells.length; i++) { // maxfrozen
1610
+ td = cells[i];
1611
+ if (td != null && td.nodeName.toUpperCase() === "TH") {
1612
+ height = Math.max(height, $(td).height());
1613
+ }
1614
+ }
1615
+ }
1616
+ newHeightFrozen = height + (posTop - tableTop) + (frozenTableTop - posFrozenTop);
1617
+ safeHeightSet($frozenRow, newHeightFrozen);
1618
+ }
1619
+ }
1620
+ }
1621
+ safeHeightSet($hDiv, hDivBase.clientHeight);
1622
+ }
1623
+ },
1624
+ /** @const */
1625
+ resizeAll = {
1626
+ resizeDiv: true,
1627
+ resizedRows: {
1628
+ iRowStart: 0,
1629
+ iRowEnd: -1 // -1 means "till the end"
1630
+ }
1631
+ },
1632
+ /** @const */
1633
+ fullResize = {
1634
+ header: resizeAll,
1635
+ resizeFooter: true,
1636
+ body: resizeAll
1637
+ };
1638
+
1639
+ $self.on("jqGridAfterGridComplete.setFrozenColumns", function () {
1640
+ $(p.idSel + "_frozen").remove();
1641
+ $(grid.fbDiv).height(grid.hDiv.clientHeight);
1642
+ // clone with data and events !!!
1643
+ var $frozenBTable = $(this).clone(true),
1644
+ frozenRows = $frozenBTable[0].rows,
1645
+ rows = $self[0].rows;
1646
+ $(frozenRows).filter("tr[role=row]").each(function () {
1647
+ $(this.cells).filter("td[role=gridcell]:gt(" + maxfrozen + ")").remove();
1648
+ /*if (this.id) {
1649
+ $(this).attr("id", this.id + "_frozen");
1650
+ }*/
1651
+ });
1652
+ grid.fbRows = frozenRows;
1653
+
1654
+ $frozenBTable.width(1).attr("id", p.id + "_frozen");
1655
+ $frozenBTable.appendTo(grid.fbDiv);
1656
+ if (p.hoverrows === true) {
1657
+ var hoverRows = function (tr, method, additionalRows) {
1658
+ $(tr)[method](hoverClasses);
1659
+ $(additionalRows[tr.rowIndex])[method](hoverClasses);
1660
+ };
1661
+ $(frozenRows).filter(".jqgrow").hover(
1662
+ function () {
1663
+ hoverRows(this, "addClass", rows);
1664
+ },
1665
+ function () {
1666
+ hoverRows(this, "removeClass", rows);
1667
+ }
1668
+ );
1669
+ $(rows).filter(".jqgrow").hover(
1670
+ function () {
1671
+ hoverRows(this, "addClass", frozenRows);
1672
+ },
1673
+ function () {
1674
+ hoverRows(this, "removeClass", frozenRows);
1675
+ }
1676
+ );
1677
+ }
1678
+ fixDiv(grid.fhDiv, grid.hDiv, 0, -1);
1679
+ fixDiv(grid.fbDiv, grid.bDiv, 0, -1);
1680
+ if (grid.sDiv) { fixDiv(grid.fsDiv, grid.sDiv, 0, -1); }
1681
+ });
1682
+ var myResize = function (resizeOptions) {
1683
+ $(grid.fbDiv).scrollTop($(grid.bDiv).scrollTop());
1684
+ // TODO: the width of all column headers can be changed
1685
+ // so one should recalculate frozenWidth in other way.
1686
+ if (resizeOptions.header.resizeDiv) {
1687
+ fixDiv(grid.fhDiv, grid.hDiv, resizeOptions.header.resizedRows.iRowStart, resizeOptions.header.resizedRows.iRowEnd);
1688
+ }
1689
+ if (resizeOptions.body.resizeDiv) {
1690
+ fixDiv(grid.fbDiv, grid.bDiv, resizeOptions.body.resizedRows.iRowStart, resizeOptions.body.resizedRows.iRowEnd);
1691
+ }
1692
+ if (resizeOptions.resizeFooter && grid.sDiv && resizeOptions.resizeFooter) {
1693
+ fixDiv(grid.fsDiv, grid.sDiv, 0, -1);
1694
+ }
1695
+ var frozenWidth = grid.fhDiv[0].clientWidth;
1696
+ if (resizeOptions.header.resizeDiv && grid.fhDiv != null && grid.fhDiv.length >= 1) {
1697
+ safeHeightSet($(grid.fhDiv), grid.hDiv.clientHeight);
1698
+ }
1699
+ if (resizeOptions.body.resizeDiv && grid.fbDiv != null && grid.fbDiv.length > 0) {
1700
+ safeWidthSet($(grid.fbDiv), frozenWidth);
1701
+ }
1702
+ if (resizeOptions.resizeFooter && grid.fsDiv != null && grid.fsDiv.length >= 0) {
1703
+ safeWidthSet($(grid.fsDiv), frozenWidth);
1704
+ }
1705
+ };
1706
+ $(p.gBox).on("resizestop.setFrozenColumns", function () {
1707
+ setTimeout(function () {
1708
+ myResize(fullResize);
1709
+ }, 50);
1710
+ });
1711
+ $self.on("jqGridInlineEditRow.setFrozenColumns jqGridInlineAfterRestoreRow.setFrozenColumns jqGridInlineAfterSaveRow.setFrozenColumns jqGridAfterEditCell.setFrozenColumns jqGridAfterRestoreCell.setFrozenColumns jqGridAfterSaveCell.setFrozenColumns jqGridResizeStop.setFrozenColumns", function (e, rowid) {
1712
+ // TODO: probably one should handle additional events like afterSetRow
1713
+ // and remove jqGridInlineAfterSaveRow and jqGridInlineAfterRestoreRow
1714
+ var iRow = $self.jqGrid("getInd", rowid);
1715
+ myResize({
1716
+ header: {
1717
+ resizeDiv: false, // don't recalculate the position and the height of hDiv
1718
+ resizedRows: {
1719
+ iRowStart: -1, // -1 means don't recalculate heights or rows
1720
+ iRowEnd: -1
1721
+ }
1722
+ },
1723
+ resizeFooter: true, // recalculate the position and the height of sDiv
1724
+ body: {
1725
+ resizeDiv: true, // recalculate the position and the height of bDiv
1726
+ resizedRows: {
1727
+ // recalculate the height of only one row inside of bDiv
1728
+ iRowStart: iRow,
1729
+ iRowEnd: iRow
1730
+ }
1731
+ }
1732
+ });
1733
+ });
1734
+ $self.on("jqGridResizeStop.setFrozenColumns", function () {
1735
+ myResize(fullResize);
1736
+ });
1737
+ $self.on("jqGridResetFrozenHeights.setFrozenColumns", function (e, o) {
1738
+ myResize(o || fullResize);
1739
+ });
1740
+ if (!grid.hDiv.loading) {
1741
+ setTimeout(function () {
1742
+ $self.triggerHandler("jqGridAfterGridComplete");
1743
+ }, 0);
1744
+ }
1745
+ p.frozenColumns = true;
1746
+ }
1747
+ });
1748
+ },
1749
+ destroyFrozenColumns: function () {
1750
+ return this.each(function () {
1751
+ var $t = this, $self = $($t), grid = $t.grid, p = $t.p, tid = jqID(p.id);
1752
+ if (!grid) { return; }
1753
+ if (p.frozenColumns === true) {
1754
+ $(grid.fhDiv).remove();
1755
+ $(grid.fbDiv).off(".setFrozenColumns");
1756
+ $(grid.fbDiv).remove();
1757
+ grid.fhDiv = null;
1758
+ grid.fbDiv = null;
1759
+ grid.fbRows = null;
1760
+ if (p.footerrow) {
1761
+ $(grid.fsDiv).remove();
1762
+ grid.fsDiv = null;
1763
+ }
1764
+ $self.off(".setFrozenColumns");
1765
+ if (p.hoverrows === true) {
1766
+ var ptr, hoverClasses = getGuiStyles.call($t, "states.hover");
1767
+ $self.on("mouseover.jqGrid", function (e) {
1768
+ ptr = $(e.target).closest("tr.jqgrow");
1769
+ if ($(ptr).attr("class") !== "ui-subgrid") {
1770
+ $(ptr).addClass(hoverClasses);
1771
+ }
1772
+ }).on("mouseout.jqGrid", function (e) {
1773
+ ptr = $(e.target).closest("tr.jqgrow");
1774
+ $(ptr).removeClass(hoverClasses);
1775
+ });
1776
+ }
1777
+ p.frozenColumns = false;
1778
+ if (p.sortable) {
1779
+ var $colHeaderRow = $(grid.hDiv).find(".ui-jqgrid-htable .ui-jqgrid-labels");
1780
+ $colHeaderRow.sortable("destroy");
1781
+ $self.jqGrid("setGridParam", {
1782
+ sortable: {
1783
+ options: {
1784
+ items: ">th:not(:has(#jqgh_" + tid + "_cb" + ",#jqgh_" + tid + "_rn" + ",#jqgh_" + tid + "_subgrid),:hidden)"
1785
+ }
1786
+ }
1787
+ });
1788
+ $self.jqGrid("sortableColumns", $colHeaderRow);
1789
+ }
1790
+ }
1791
+ });
1792
+ }
1793
+ });
1794
+ // end module grid.custom
1795
+ }));