jsxgrid 2.3.1 → 2.4.0
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/README.md +40 -0
- package/dist/fields/jsgrid.field.XDateTimeField.min.js +2 -2
- package/dist/fields/jsgrid.field.XRowSelectField.min.js +1 -1
- package/dist/fields/jsgrid.field.Xcheckbox.min.js +2 -2
- package/dist/fields/jsgrid.field.Xcontrol.min.js +1 -1
- package/dist/fields/jsgrid.field.XimgField.min.js +2 -2
- package/dist/fields/jsgrid.field.Xjsoneditor.min.js +2 -2
- package/dist/fields/jsgrid.field.Xnumber.min.js +2 -2
- package/dist/fields/jsgrid.field.Xselect.min.js +2 -2
- package/dist/fields/jsgrid.field.Xtext.min.js +2 -2
- package/dist/fields/jsgrid.field.Xtextarea.min.js +2 -2
- package/dist/fields/lib/jsGridSummaryPlugin.min.js +1 -1
- package/dist/fields/lib/jsgrid.popup.basic.min.js +1 -1
- package/dist/jsxgrid-fields.js +1 -1
- package/dist/jsxgrid-fields.min.js +1 -1
- package/dist/jsxgrid-theme.css +1 -1
- package/dist/jsxgrid-xfields.js +91 -58
- package/dist/jsxgrid-xfields.min.js +2 -2
- package/dist/jsxgrid.css +1 -1
- package/dist/jsxgrid.js +40 -2
- package/dist/jsxgrid.min.js +2 -2
- package/package.json +1 -1
- package/src/fields/jsgrid.field.XDateTimeField.js +10 -9
- package/src/fields/jsgrid.field.Xcheckbox.js +14 -9
- package/src/fields/jsgrid.field.XimgField.js +10 -9
- package/src/fields/jsgrid.field.Xjsoneditor.js +15 -9
- package/src/fields/jsgrid.field.Xnumber.js +6 -1
- package/src/fields/jsgrid.field.Xselect.js +15 -10
- package/src/fields/jsgrid.field.Xtext.js +6 -1
- package/src/fields/jsgrid.field.Xtextarea.js +14 -9
- package/src/jsgrid.core.js +38 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(jsGrid, $, undefined) {
|
|
2
|
-
|
|
3
|
-
if (!jsGrid) {
|
|
4
|
-
if (window.console) {
|
|
5
|
-
console.error("[jsxgrid] jsgrid.field.Xtextarea.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
6
|
-
}
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
1
|
+
(function(jsGrid, $, undefined) {
|
|
2
|
+
|
|
3
|
+
if (!jsGrid) {
|
|
4
|
+
if (window.console) {
|
|
5
|
+
console.error("[jsxgrid] jsgrid.field.Xtextarea.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
6
|
+
}
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
// Standalone: does not extend jsGrid.TextAreaField, only jsGrid.Field.
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
readOnly: false,
|
|
22
22
|
maxShowSymbols: 50,
|
|
23
23
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
24
|
+
defaultValue: null,//value to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
24
25
|
|
|
25
26
|
filterTemplate: function () {
|
|
26
27
|
if (!this.filtering)
|
|
@@ -54,7 +55,11 @@
|
|
|
54
55
|
if (!this.inserting)
|
|
55
56
|
return "";
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
var $result = this.insertControl = this._createTextArea();
|
|
59
|
+
if (this.defaultValue !== null) {
|
|
60
|
+
$result.val(this.defaultValue);
|
|
61
|
+
}
|
|
62
|
+
return $result;
|
|
58
63
|
},
|
|
59
64
|
|
|
60
65
|
editTemplate: function (value) {
|
package/src/jsgrid.core.js
CHANGED
|
@@ -136,6 +136,13 @@
|
|
|
136
136
|
sortAscClass: "jsgrid-header-sort jsgrid-header-sort-asc",
|
|
137
137
|
sortDescClass: "jsgrid-header-sort jsgrid-header-sort-desc",
|
|
138
138
|
|
|
139
|
+
// jsxgrid extension: initial sort applied once at construction (field
|
|
140
|
+
// name/index/reference + "asc"/"desc"), baked into the first render/load
|
|
141
|
+
// instead of requiring a separate sort() call (and the extra
|
|
142
|
+
// refresh/reload that would trigger) right after creating the grid.
|
|
143
|
+
sortField: null,
|
|
144
|
+
sortOrder: null,
|
|
145
|
+
|
|
139
146
|
paging: false,
|
|
140
147
|
pagerContainer: null,
|
|
141
148
|
pageIndex: 1,
|
|
@@ -209,11 +216,38 @@
|
|
|
209
216
|
this._initLoadStrategy();
|
|
210
217
|
this._initController();
|
|
211
218
|
this._initFields();
|
|
219
|
+
this._initSorting();
|
|
212
220
|
this._attachWindowLoadResize();
|
|
213
221
|
this._attachWindowResizeCallback();
|
|
214
222
|
this._callEventHandler(this.onInit)
|
|
215
223
|
},
|
|
216
224
|
|
|
225
|
+
_initSorting: function() {
|
|
226
|
+
if(!this.sortField) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
var field = this._normalizeField(this.sortField);
|
|
231
|
+
if(!field) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
this._sortField = field;
|
|
236
|
+
this._sortOrder = this.sortOrder || SORT_ORDER_ASC;
|
|
237
|
+
|
|
238
|
+
// Static in-memory data (already present at construction time, not
|
|
239
|
+
// fetched via a controller) needs an explicit sort here - normal
|
|
240
|
+
// rendering never sorts on its own, only an actual sort() call does
|
|
241
|
+
// (see DirectLoadingStrategy.sort()). Controller-backed data follows
|
|
242
|
+
// the same rule sorting already does elsewhere: pageLoading sends
|
|
243
|
+
// sortField/sortOrder to the server via loadData()'s filter, while
|
|
244
|
+
// plain (non-paged) controller data is left as the controller
|
|
245
|
+
// returns it, same as clicking a sortable header would leave it.
|
|
246
|
+
if($.isArray(this.data) && this.data.length) {
|
|
247
|
+
this._sortData();
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
|
|
217
251
|
_initInstanceLocale: function(locale) {
|
|
218
252
|
if(!locale) {
|
|
219
253
|
return;
|
|
@@ -533,6 +567,10 @@
|
|
|
533
567
|
.on("click", $.proxy(function() {
|
|
534
568
|
this.sort(index);
|
|
535
569
|
}, this));
|
|
570
|
+
|
|
571
|
+
if(field === this._sortField) {
|
|
572
|
+
$th.addClass(this._sortOrder === SORT_ORDER_ASC ? this.sortAscClass : this.sortDescClass);
|
|
573
|
+
}
|
|
536
574
|
}
|
|
537
575
|
});
|
|
538
576
|
|