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
package/README.md
CHANGED
|
@@ -130,6 +130,8 @@ The config object may contain following options (default values are specified be
|
|
|
130
130
|
editing: false,
|
|
131
131
|
selecting: true,
|
|
132
132
|
sorting: false,
|
|
133
|
+
sortField: null, // initial sort, see below
|
|
134
|
+
sortOrder: null, // "asc" | "desc", defaults to "asc" when sortField is set
|
|
133
135
|
paging: false,
|
|
134
136
|
pageLoading: false,
|
|
135
137
|
|
|
@@ -307,6 +309,31 @@ A boolean value specifies whether to highlight grid rows on hover.
|
|
|
307
309
|
### sorting (default: `false`)
|
|
308
310
|
A boolean value specifies whether sorting is allowed.
|
|
309
311
|
|
|
312
|
+
### sortField / sortOrder (default: `null` / `null`)
|
|
313
|
+
> jsxgrid extension, not in upstream jsGrid
|
|
314
|
+
|
|
315
|
+
Sets the initial sort, applied once at construction - baked into the first render/load, unlike calling
|
|
316
|
+
`sort()` after creating the grid (which would trigger its own extra refresh/reload). `sortField` accepts
|
|
317
|
+
anything `sort()` does: a field name, a zero-based field index, or a field reference. `sortOrder` is
|
|
318
|
+
`"asc"` or `"desc"`, defaulting to `"asc"` when `sortField` is set. Requires `sorting: true`.
|
|
319
|
+
|
|
320
|
+
With `pageLoading: true`, the initial `sortField`/`sortOrder` are sent to `controller.loadData` like any
|
|
321
|
+
other sort (same as clicking a sortable header would). For static in-memory `data` (not loaded through a
|
|
322
|
+
controller), the array is sorted immediately, before the first render. For a controller-backed grid without
|
|
323
|
+
`pageLoading`, the data is left in whatever order the controller returns it - same as clicking a header
|
|
324
|
+
does in that setup upstream.
|
|
325
|
+
|
|
326
|
+
```javascript
|
|
327
|
+
|
|
328
|
+
$("#grid").jsGrid({
|
|
329
|
+
sorting: true,
|
|
330
|
+
sortField: "Name",
|
|
331
|
+
sortOrder: "desc",
|
|
332
|
+
...
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
|
|
310
337
|
### paging (default: `false`)
|
|
311
338
|
A boolean value specifies whether data is displayed by pages.
|
|
312
339
|
|
|
@@ -696,6 +723,11 @@ never filters) supports a shared `defaultSelected` convention: a value used to p
|
|
|
696
723
|
*first* time its filter row is rendered, then reset to `null` so it doesn't keep overriding what the user
|
|
697
724
|
searches for afterwards.
|
|
698
725
|
|
|
726
|
+
Every one of them (except `XRowSelectField` and `Xcontrol`, neither of which has a value to insert) also
|
|
727
|
+
supports `defaultValue`: a value used to prefill the *insert* row's control. Unlike `defaultSelected`, this
|
|
728
|
+
is **not** reset after use — it's applied every time a fresh insert row is built (including after
|
|
729
|
+
`clearInsert()`), so a new row keeps starting from the same default until you change it in code.
|
|
730
|
+
|
|
699
731
|
As of `Xtext`/`Xnumber`/`Xcontrol`, every native field type (`text`, `number`, `select`, `checkbox`,
|
|
700
732
|
`textarea`, `control`) now has an X-branded equivalent — the native set (`dist/jsxgrid-fields.js`) is kept
|
|
701
733
|
around as legacy/optional, with new work going into the X set going forward.
|
|
@@ -708,6 +740,7 @@ Drop-in replacement for `text`.
|
|
|
708
740
|
|---|---|---|
|
|
709
741
|
| `readOnly` | `false` | Whether the input is readonly. |
|
|
710
742
|
| `defaultSelected` | `null` | A string to preset the filter input with. |
|
|
743
|
+
| `defaultValue` | `null` | A string to prefill the insert row with. |
|
|
711
744
|
|
|
712
745
|
#### Xnumber
|
|
713
746
|
|
|
@@ -718,6 +751,7 @@ every other X-field.
|
|
|
718
751
|
|---|---|---|
|
|
719
752
|
| `readOnly` | `false` | Whether the input is readonly. |
|
|
720
753
|
| `defaultSelected` | `null` | A number (or numeric string) to preset the filter input with. |
|
|
754
|
+
| `defaultValue` | `null` | A number (or numeric string) to prefill the insert row with. |
|
|
721
755
|
|
|
722
756
|
#### Xcheckbox
|
|
723
757
|
|
|
@@ -727,6 +761,7 @@ type-coercion headaches (especially with databases).
|
|
|
727
761
|
| Option | Default | Description |
|
|
728
762
|
|---|---|---|
|
|
729
763
|
| `defaultSelected` | `null` | `0`/`1`/`true`/`false` to preset the filter checkbox as unchecked/checked; leave `null` for the default indeterminate ("any") state. |
|
|
764
|
+
| `defaultValue` | `null` | `0`/`1`/`true`/`false` to prefill the insert row checkbox as unchecked/checked. |
|
|
730
765
|
|
|
731
766
|
#### XimgField
|
|
732
767
|
|
|
@@ -737,6 +772,7 @@ Text field that previews its value as an `<img>`.
|
|
|
737
772
|
| `fm_callback` | `null` | `function(control)` — if set, insert/edit renders a button instead of a text input, and clicking it calls this callback with the jQuery-wrapped control so you can wire up your own file manager/picker. |
|
|
738
773
|
| `editButtonText` | `'Open FM'` | Text for that button. |
|
|
739
774
|
| `defaultSelected` | `null` | A string to preset the filter input with. |
|
|
775
|
+
| `defaultValue` | `null` | A string to prefill the insert row with (the plain-text-input mode; still stored even in `fm_callback` button mode). |
|
|
740
776
|
|
|
741
777
|
#### Xselect
|
|
742
778
|
|
|
@@ -747,6 +783,7 @@ Drop-in replacement for `select`, plus:
|
|
|
747
783
|
| `pseudoElement` | `null` | An extra item unshifted to the start of the filter dropdown (e.g. an "any" option). Shape must match your `items` (object for object-items, or a `{[textField]:'', [valueField]:null}`-like item for array items). |
|
|
748
784
|
| `select2` | `null` | Config object passed to [select2](https://select2.org/) on the filter control (`width` is always forced to `100%`). Applied via `setTimeout(0)` so the control is attached to the DOM first. |
|
|
749
785
|
| `defaultSelected` | `null` | A value to preselect in the filter, matched against `items` by `valueField` (or by array index / object key if there's no `valueField`). |
|
|
786
|
+
| `defaultValue` | `null` | A value to preselect in the insert row, matched the same way. |
|
|
750
787
|
|
|
751
788
|
#### Xtextarea
|
|
752
789
|
|
|
@@ -756,6 +793,7 @@ Long text is collapsed and expandable on click.
|
|
|
756
793
|
|---|---|---|
|
|
757
794
|
| `maxShowSymbols` | `50` | Values longer than this are truncated with `...`; click the cell to expand. |
|
|
758
795
|
| `defaultSelected` | `null` | A string to preset the filter input with. |
|
|
796
|
+
| `defaultValue` | `null` | A string to prefill the insert row with. |
|
|
759
797
|
|
|
760
798
|
#### Xjsoneditor
|
|
761
799
|
|
|
@@ -769,6 +807,7 @@ the editor).
|
|
|
769
807
|
| `editText` | `'Editor'` | Text of the button shown in view mode. |
|
|
770
808
|
| `closeText` | `'Save'` | Close-button text used when opening the editor for insert/edit. |
|
|
771
809
|
| `defaultSelected` | `null` | A string to preset the (text-based) filter input with — the filter matches against the raw JSON string, not parsed values. |
|
|
810
|
+
| `defaultValue` | `null` | A JSON value (object, or an already-stringified string) to prefill the insert row with. |
|
|
772
811
|
|
|
773
812
|
#### XRowSelectField
|
|
774
813
|
|
|
@@ -794,6 +833,7 @@ Date/datetime field backed by a native `<input type="datetime-local">` (or whate
|
|
|
794
833
|
| `dateRange` | `false` | When `true`, the filter renders two date inputs (`from`/`to`) instead of one, and `filterValue()` returns `{from, to}`. |
|
|
795
834
|
| `options` | built-in `Intl.DateTimeFormat` options | Passed to `toLocaleDateString()` when rendering the item view. Empty values render as an empty string. |
|
|
796
835
|
| `defaultSelected` | `null` | A value (matching `datePickerType`'s input format) to preset the filter with. When `dateRange` is `true`, pass `{from, to}` instead. |
|
|
836
|
+
| `defaultValue` | `null` | A value (matching `datePickerType`'s input format) to prefill the insert row with. Not currently supported when `dateRange` is `true` (`insertTemplate()` doesn't render a range picker). |
|
|
797
837
|
|
|
798
838
|
#### Xcontrol
|
|
799
839
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((t,
|
|
6
|
+
((t,n)=>{var e;t?((e=function(e){t.Field.call(this,e)}).prototype=new t.Field({css:"date-field",align:"center",datePickerType:"datetime-local",dateRange:!1,defaultSelected:null,defaultValue:null,sorter:function(e,t){return new Date(e)-new Date(t)},filterTemplate:function(){var t,e,i,r,a;return this.filtering?(t=this._grid,e=n(),this.dateRange?(a=n("<div class='jsgrid-date-range-wrapper'>"),i=n("<input>",{class:"jsgrid-date-picker jsgrid-date-start",type:this.datePickerType,title:"Period date start"}),r=n("<input>",{class:"jsgrid-date-picker jsgrid-date-end",type:this.datePickerType,title:"Period date end"}),a.val=function(){return{from:i.val(),to:r.val()}},e=this.filterControl=a.append(i).append(r),null!==this.defaultSelected&&(a=this.defaultSelected||{},i.val(a.from||""),r.val(a.to||""),this.defaultSelected=null),this.autosearch&&e.on("change",".jsgrid-date-picker",function(e){t.search()})):(e=this.filterControl=this._createPicker(),null!==this.defaultSelected&&(e.val(this.defaultSelected),this.defaultSelected=null),this.autosearch&&e.on("change",function(e){t.search()})),e):""},filterValue:function(){return this.filterControl.val()},itemTemplate:function(e){var t;return e?(t=this.options||{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"},new Date(e.replace(" ","T")).toLocaleDateString(void 0,t)):""},insertTemplate:function(){return this._insertPicker=this._createPicker().val(this.defaultValue||"")},editTemplate:function(e){return this._editPicker=this._createPicker().val(e)},insertValue:function(){return this._insertPicker.val()},editValue:function(){return this._editPicker.val()},_createPicker:function(){return n("<input class='date-picker'>").attr("type",this.datePickerType)}}),t.fields.XDateTimeField=e):window.console&&console.error("[jsxgrid] jsgrid.field.XDateTimeField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((e,i)=>{var t,r;e?(t=e.Field,(r=function(e){t.call(this,e)}).prototype=new t({sorter:"number",align:"center",autosearch:!0,defaultSelected:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,(t=this.filterControl=this._createCheckbox()).prop({readOnly:!0,indeterminate:!0}),t.on("click",function(){var e=i(this);e.prop("readOnly")?e.prop({checked:!1,readOnly:!1}):e.prop("checked")||e.prop({readOnly:!0,indeterminate:!0})}),this.autosearch&&t.on("click",function(){e.search()}),null!==this.defaultSelected&&(t.prop({checked:!!this.defaultSelected,indeterminate:!1,readOnly:!1}),this.defaultSelected=null),t):""},filterValue:function(){return this.filterControl.get(0).indeterminate?void 0:this.filterControl.is(":checked")?1:0},insertTemplate:function(){return this.inserting?this.insertControl=this._createCheckbox():""},insertValue:function(){return+this.insertControl.is(":checked")},editValue:function(){return+this.editControl.is(":checked")},itemTemplate:function(e){return this._createCheckbox().prop({checked:+e,disabled:!0})},editTemplate:function(e){var t;return this.editing?((t=this.editControl=this._createCheckbox()).prop("checked",+e),t):this.itemTemplate.apply(this,arguments)},_createCheckbox:function(){return i("<input>").attr("type","checkbox")}}),e.fields.Xcheckbox=r):window.console&&console.error("[jsxgrid] jsgrid.field.Xcheckbox.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
6
|
+
((e,i)=>{var t,r;e?(t=e.Field,(r=function(e){t.call(this,e)}).prototype=new t({sorter:"number",align:"center",autosearch:!0,defaultSelected:null,defaultValue:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,(t=this.filterControl=this._createCheckbox()).prop({readOnly:!0,indeterminate:!0}),t.on("click",function(){var e=i(this);e.prop("readOnly")?e.prop({checked:!1,readOnly:!1}):e.prop("checked")||e.prop({readOnly:!0,indeterminate:!0})}),this.autosearch&&t.on("click",function(){e.search()}),null!==this.defaultSelected&&(t.prop({checked:!!this.defaultSelected,indeterminate:!1,readOnly:!1}),this.defaultSelected=null),t):""},filterValue:function(){return this.filterControl.get(0).indeterminate?void 0:this.filterControl.is(":checked")?1:0},insertTemplate:function(){var e;return this.inserting?(e=this.insertControl=this._createCheckbox(),null!==this.defaultValue&&e.prop("checked",!!this.defaultValue),e):""},insertValue:function(){return+this.insertControl.is(":checked")},editValue:function(){return+this.editControl.is(":checked")},itemTemplate:function(e){return this._createCheckbox().prop({checked:+e,disabled:!0})},editTemplate:function(e){var t;return this.editing?((t=this.editControl=this._createCheckbox()).prop("checked",+e),t):this.itemTemplate.apply(this,arguments)},_createCheckbox:function(){return i("<input>").attr("type","checkbox")}}),e.fields.Xcheckbox=r):window.console&&console.error("[jsxgrid] jsgrid.field.Xcheckbox.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((t,n)=>{var e,i;t?(e=t.Field,(i=function(t){e.call(this,t)}).prototype=new e({autosearch:!0,readOnly:!1,fm_callback:null,editButtonText:"Open FM",defaultSelected:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},filterValue:function(){return this.filterControl.val()},itemTemplate:function(t){var e=n('<img class="jsgrid-img" src="">');return e.attr("src",t||""),e.css("max-height","50px"),e.css("max-width","50px"),e},editTemplate:function(t){var e,i;return this.editing?(e=this.fm_callback,i=this.editControl=n('<input type="text">').val(t||""),e?n('<button class="jsgrid-imgField-button">'+this.editButtonText+"</button>").click(function(){e(i)}):i):this.itemTemplate.apply(this,arguments)},insertTemplate:function(){var t,e;return this.inserting?(t=this.fm_callback,e=this.insertControl=n('<input type="text">'),"function"==typeof t?n('<button class="jsgrid-imgField-button">'+this.editButtonText+"</button>").click(function(){t(e)}):e):""},insertValue:function(){return this.insertControl.val()},editValue:function(){return this.editControl.val()},_createTextBox:function(){return n("<input>").attr("type","text").prop("readonly",!!this.readOnly)}}),t.fields.XimgField=i):window.console&&console.error("[jsxgrid] jsgrid.field.XimgField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
6
|
+
((t,n)=>{var e,i;t?(e=t.Field,(i=function(t){e.call(this,t)}).prototype=new e({autosearch:!0,readOnly:!1,fm_callback:null,editButtonText:"Open FM",defaultSelected:null,defaultValue:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},filterValue:function(){return this.filterControl.val()},itemTemplate:function(t){var e=n('<img class="jsgrid-img" src="">');return e.attr("src",t||""),e.css("max-height","50px"),e.css("max-width","50px"),e},editTemplate:function(t){var e,i;return this.editing?(e=this.fm_callback,i=this.editControl=n('<input type="text">').val(t||""),e?n('<button class="jsgrid-imgField-button">'+this.editButtonText+"</button>").click(function(){e(i)}):i):this.itemTemplate.apply(this,arguments)},insertTemplate:function(){var t,e;return this.inserting?(t=this.fm_callback,e=this.insertControl=n('<input type="text">').val(this.defaultValue||""),"function"==typeof t?n('<button class="jsgrid-imgField-button">'+this.editButtonText+"</button>").click(function(){t(e)}):e):""},insertValue:function(){return this.insertControl.val()},editValue:function(){return this.editControl.val()},_createTextBox:function(){return n("<input>").attr("type","text").prop("readonly",!!this.readOnly)}}),t.fields.XimgField=i):window.console&&console.error("[jsxgrid] jsgrid.field.XimgField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((n
|
|
6
|
+
((i,n)=>{var e,t;i?(e=i.Field,(t=function(t){e.call(this,t)}).prototype=new e({autosearch:!0,readOnly:!1,templates:[],closeText:"Save",editText:"Editor",defaultSelected:null,defaultValue:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},filterValue:function(){return this.filterControl.val()},insertValue:function(){return this.insertControl.val()},editValue:function(){return this.editControl.val()},_createTextBox:function(){return n("<input>").attr("type","text").prop("readonly",!!this.readOnly)},_doModal:function(t,e,r){return i.popup(t,e)},_createJsonEditor:function(t,e){if("undefined"==typeof JSONEditor)throw new Error("Xjsoneditor requires the 'jsoneditor' package to be loaded on the page.");"object"!=typeof(t=t||{})&&(t=JSON.parse(t));var r=n('<div style="height: 500px;">'),e=(n("body").append(r),r=r[0],{templates:this.templates,modes:["code","text","tree"],onError:function(t){alert(t.toString())},mode:e||"view"});return new JSONEditor(r,e,t)},itemTemplate:function(e,t){var r=this;return n("<button>"+r.editText+"</button>").click(function(){var t=r._createJsonEditor(e);return r._doModal(t.container,{onClose:function(){n(t.container).remove(),t.destroy()}}),!1})},insertTemplate:function(){var t,e;return this.inserting?(t=this,e=n("<textarea>"),null!==this.defaultValue&&e.val("string"==typeof this.defaultValue?this.defaultValue:JSON.stringify(this.defaultValue)),this.insertControl=e.click(function(){var e=t._createJsonEditor({},"tree"),r=n(this);return t._doModal(e.container,{closeText:t.closeText,onClose:function(){var t=e.get();n.isEmptyObject(t)?r.val({}):r.val(JSON.stringify(t)),e.destroy()}}),!1})):""},editTemplate:function(t){var i;return this.editing?(i=this).editControl=n("<textarea>").val(t).click(function(){var e=n(this),r=i._createJsonEditor(e.val(),"tree");return i._doModal(r.container,{closeText:i.closeText,onClose:function(){var t=r.get();n.isEmptyObject(t)?e.val({}):e.val(JSON.stringify(t)),r.destroy()}}),!1}):this.itemTemplate.apply(this,arguments)}}),i.fields.Xjsoneditor=t):window.console&&console.error("[jsxgrid] jsgrid.field.Xjsoneditor.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((t,e,i)=>{var r,n;t?(r=t.Field,(n=function(t){r.call(this,t)}).prototype=new r({sorter:"number",align:"right",autosearch:!0,readOnly:!1,defaultSelected:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},insertTemplate:function(){return this.inserting?this.insertControl=this._createTextBox():""},editTemplate:function(t){var e;return this.editing?((e=this.editControl=this._createTextBox()).val(t),e):this.itemTemplate.apply(this,arguments)},filterValue:function(){return this.filterControl.val()?parseInt(this.filterControl.val()||0,10):i},insertValue:function(){return this.insertControl.val()?parseInt(this.insertControl.val()||0,10):i},editValue:function(){return this.editControl.val()?parseInt(this.editControl.val()||0,10):i},_createTextBox:function(){return e("<input>").attr("type","number").prop("readonly",!!this.readOnly)}}),t.fields.Xnumber=n):window.console&&console.error("[jsxgrid] jsgrid.field.Xnumber.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
6
|
+
((t,e,i)=>{var r,n;t?(r=t.Field,(n=function(t){r.call(this,t)}).prototype=new r({sorter:"number",align:"right",autosearch:!0,readOnly:!1,defaultSelected:null,defaultValue:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},insertTemplate:function(){var t;return this.inserting?(t=this.insertControl=this._createTextBox(),null!==this.defaultValue&&t.val(this.defaultValue),t):""},editTemplate:function(t){var e;return this.editing?((e=this.editControl=this._createTextBox()).val(t),e):this.itemTemplate.apply(this,arguments)},filterValue:function(){return this.filterControl.val()?parseInt(this.filterControl.val()||0,10):i},insertValue:function(){return this.insertControl.val()?parseInt(this.insertControl.val()||0,10):i},editValue:function(){return this.editControl.val()?parseInt(this.editControl.val()||0,10):i},_createTextBox:function(){return e("<input>").attr("type","number").prop("readonly",!!this.readOnly)}}),t.fields.Xnumber=n):window.console&&console.error("[jsxgrid] jsgrid.field.Xnumber.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((e,a,l)=>{var i,s,t;e?(i=e.Field,(t=function(e){var t;this.items=[],this.selectedIndex=-1,this.valueField="",this.textField="",e.valueField&&e.items&&e.items.length&&(t=e.items[0][e.valueField],this.valueType=typeof t==s?s:"string"),this.sorter=this.valueType,i.call(this,e)}).prototype=new i({align:"center",autosearch:!0,valueType:s="number",pseudoElement:null,select2:null,defaultSelected:null,itemTemplate:function(t){var e=this.items,i=this.valueField,s=this.textField,e=i?"object"==typeof t?t:a.grep(e,function(e){return e[i]===t})[0]||{}:e[t],s=s?e[s]:e;return s===l||null===s?"":s},insertTemplate:function(){return this.inserting?this.insertControl=this._createSelect():""},editTemplate:function(e){var t,i;return this.editing?(t=this.editControl=this._createSelect(),(i="object"==typeof(i=e)?e[this.valueField]:e)!==l&&t.val(i),t):this.itemTemplate.apply(this,arguments)},insertValue:function(){var e=this.insertControl.val();return this.valueType===s?parseInt(e||0,10):e},editValue:function(){var e=this.editControl.val();return this.valueType===s?parseInt(e||0,10):e},filterTemplate:function(){var e,i,s,l,t,n;return this.filtering?(Array.isArray(this.items)?(e=this.items.slice(0),this.pseudoElement?e.unshift(this.pseudoElement):((n={})[this.textField]="",n[this.valueField]=null,e.unshift(n))):"object"==typeof this.items&&(e=Object.assign({},this.items),e="object"==typeof this.pseudoElement&&this.pseudoElement?Object.assign({},e,this.pseudoElement):Object.assign({},{"":null},e)),null!==this.defaultSelected&&(i=this.valueField,s=this.defaultSelected,l=-1,a.each(e,function(e,t){if((i?t[i]:e)==s)return l=e,!1}),-1!==l&&(this.selectedIndex=l),this.defaultSelected=null),t=this._grid,n=this.filterControl=this._createSelect(e),this.autosearch&&n.on("change",function(e){t.search()}),n):""},filterValue:function(){var e=this.filterControl.val();return this.valueType===s?parseInt(e||0,10):e},_createSelect:function(e){var t,s=a("<select>"),l=this.valueField,n=this.textField,r=this.selectedIndex;return a.each(e||this.items,function(e,t){var i=l?t[l]:e,t=n?t[n]:t;a("<option>").attr("value",i).text(t).appendTo(s).prop("selected",r===e)}),s.prop("disabled",!!this.readOnly),this.select2&&(t=Object.assign({},this.select2,{width:"100%"}),setTimeout(function(){s.select2(t)},0)),s}}),e.fields.Xselect=t):window.console&&console.error("[jsxgrid] jsgrid.field.Xselect.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
6
|
+
((e,a,l)=>{var i,s,t;e?(i=e.Field,(t=function(e){var t;this.items=[],this.selectedIndex=-1,this.valueField="",this.textField="",e.valueField&&e.items&&e.items.length&&(t=e.items[0][e.valueField],this.valueType=typeof t==s?s:"string"),this.sorter=this.valueType,i.call(this,e)}).prototype=new i({align:"center",autosearch:!0,valueType:s="number",pseudoElement:null,select2:null,defaultSelected:null,defaultValue:null,itemTemplate:function(t){var e=this.items,i=this.valueField,s=this.textField,e=i?"object"==typeof t?t:a.grep(e,function(e){return e[i]===t})[0]||{}:e[t],s=s?e[s]:e;return s===l||null===s?"":s},insertTemplate:function(){var e;return this.inserting?(e=this.insertControl=this._createSelect(),null!==this.defaultValue&&e.val(this.defaultValue),e):""},editTemplate:function(e){var t,i;return this.editing?(t=this.editControl=this._createSelect(),(i="object"==typeof(i=e)?e[this.valueField]:e)!==l&&t.val(i),t):this.itemTemplate.apply(this,arguments)},insertValue:function(){var e=this.insertControl.val();return this.valueType===s?parseInt(e||0,10):e},editValue:function(){var e=this.editControl.val();return this.valueType===s?parseInt(e||0,10):e},filterTemplate:function(){var e,i,s,l,t,n;return this.filtering?(Array.isArray(this.items)?(e=this.items.slice(0),this.pseudoElement?e.unshift(this.pseudoElement):((n={})[this.textField]="",n[this.valueField]=null,e.unshift(n))):"object"==typeof this.items&&(e=Object.assign({},this.items),e="object"==typeof this.pseudoElement&&this.pseudoElement?Object.assign({},e,this.pseudoElement):Object.assign({},{"":null},e)),null!==this.defaultSelected&&(i=this.valueField,s=this.defaultSelected,l=-1,a.each(e,function(e,t){if((i?t[i]:e)==s)return l=e,!1}),-1!==l&&(this.selectedIndex=l),this.defaultSelected=null),t=this._grid,n=this.filterControl=this._createSelect(e),this.autosearch&&n.on("change",function(e){t.search()}),n):""},filterValue:function(){var e=this.filterControl.val();return this.valueType===s?parseInt(e||0,10):e},_createSelect:function(e){var t,s=a("<select>"),l=this.valueField,n=this.textField,r=this.selectedIndex;return a.each(e||this.items,function(e,t){var i=l?t[l]:e,t=n?t[n]:t;a("<option>").attr("value",i).text(t).appendTo(s).prop("selected",r===e)}),s.prop("disabled",!!this.readOnly),this.select2&&(t=Object.assign({},this.select2,{width:"100%"}),setTimeout(function(){s.select2(t)},0)),s}}),e.fields.Xselect=t):window.console&&console.error("[jsxgrid] jsgrid.field.Xselect.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((t,e)=>{var i,
|
|
6
|
+
((t,e)=>{var i,l;t?(i=t.Field,(l=function(t){i.call(this,t)}).prototype=new i({autosearch:!0,readOnly:!1,defaultSelected:null,defaultValue:null,filterTemplate:function(){var e,t;return this.filtering?(e=this._grid,t=this.filterControl=this._createTextBox(),this.autosearch&&t.on("keypress",function(t){13===t.which&&(e.search(),t.preventDefault())}),null!==this.defaultSelected&&(t.val(this.defaultSelected),this.defaultSelected=null),t):""},insertTemplate:function(){var t;return this.inserting?(t=this.insertControl=this._createTextBox(),null!==this.defaultValue&&t.val(this.defaultValue),t):""},editTemplate:function(t){var e;return this.editing?((e=this.editControl=this._createTextBox()).val(t),e):this.itemTemplate.apply(this,arguments)},filterValue:function(){return this.filterControl.val()},insertValue:function(){return this.insertControl.val()},editValue:function(){return this.editControl.val()},_createTextBox:function(){return e("<input>").attr("type","text").prop("readonly",!!this.readOnly)}}),t.fields.Xtext=l):window.console&&console.error("[jsxgrid] jsgrid.field.Xtext.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
6
|
-
((
|
|
6
|
+
((e,n)=>{var t,i;e?(t=e.Field,(i=function(e){t.call(this,e)}).prototype=new t({autosearch:!0,readOnly:!1,maxShowSymbols:50,defaultSelected:null,defaultValue:null,filterTemplate:function(){var t,e;return this.filtering?(t=this._grid,e=this.filterControl=this._createTextBox(),this.autosearch&&e.on("keypress",function(e){13===e.which&&(t.search(),e.preventDefault())}),null!==this.defaultSelected&&(e.val(this.defaultSelected),this.defaultSelected=null),e):""},filterValue:function(){return this.filterControl.val()},insertTemplate:function(){var e;return this.inserting?(e=this.insertControl=this._createTextArea(),null!==this.defaultValue&&e.val(this.defaultValue),e):""},editTemplate:function(e){var t;return this.editing?((t=this.editControl=this._createTextArea()).val(e),t):this.itemTemplate.apply(this,arguments)},insertValue:function(){return this.insertControl.val()},editValue:function(){return this.editControl.val()},_createTextBox:function(){return n("<input>").attr("type","text").prop("readonly",!!this.readOnly)},_createTextArea:function(){return n("<textarea>").prop("readonly",!!this.readOnly)},itemTemplate:function(e,t){var i,r;return(e=null==e?"":String(e)).length<=this.maxShowSymbols?n("<div>").text(e):(i=e.slice(0,this.maxShowSymbols),r=n("<div>").text(i+" ...").one("click",function(){return r.text(e),!1}))}}),e.fields.Xtextarea=i):window.console&&console.error("[jsxgrid] jsgrid.field.Xtextarea.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.")})(window.jsGrid,window.jQuery);
|
package/dist/jsxgrid-fields.js
CHANGED
package/dist/jsxgrid-theme.css
CHANGED
package/dist/jsxgrid-xfields.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* jsxgrid v2.
|
|
2
|
+
* jsxgrid v2.4.0 (https://github.com/rok9ru/jsxgrid#readme)
|
|
3
3
|
* (c) 2026 Mikhail Kremza
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
@@ -170,6 +170,7 @@
|
|
|
170
170
|
autosearch: true,
|
|
171
171
|
readOnly: false,
|
|
172
172
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
173
|
+
defaultValue: null,//value to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
173
174
|
|
|
174
175
|
filterTemplate: function () {
|
|
175
176
|
if (!this.filtering)
|
|
@@ -199,7 +200,11 @@
|
|
|
199
200
|
if (!this.inserting)
|
|
200
201
|
return "";
|
|
201
202
|
|
|
202
|
-
|
|
203
|
+
var $result = this.insertControl = this._createTextBox();
|
|
204
|
+
if (this.defaultValue !== null) {
|
|
205
|
+
$result.val(this.defaultValue);
|
|
206
|
+
}
|
|
207
|
+
return $result;
|
|
203
208
|
},
|
|
204
209
|
|
|
205
210
|
editTemplate: function (value) {
|
|
@@ -257,6 +262,7 @@
|
|
|
257
262
|
autosearch: true,
|
|
258
263
|
readOnly: false,
|
|
259
264
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
265
|
+
defaultValue: null,//value to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
260
266
|
|
|
261
267
|
filterTemplate: function () {
|
|
262
268
|
if (!this.filtering)
|
|
@@ -286,7 +292,11 @@
|
|
|
286
292
|
if (!this.inserting)
|
|
287
293
|
return "";
|
|
288
294
|
|
|
289
|
-
|
|
295
|
+
var $result = this.insertControl = this._createTextBox();
|
|
296
|
+
if (this.defaultValue !== null) {
|
|
297
|
+
$result.val(this.defaultValue);
|
|
298
|
+
}
|
|
299
|
+
return $result;
|
|
290
300
|
},
|
|
291
301
|
|
|
292
302
|
editTemplate: function (value) {
|
|
@@ -326,14 +336,14 @@
|
|
|
326
336
|
|
|
327
337
|
}(window.jsGrid, window.jQuery));
|
|
328
338
|
|
|
329
|
-
(function(jsGrid, $, undefined) {
|
|
330
|
-
|
|
331
|
-
if (!jsGrid) {
|
|
332
|
-
if (window.console) {
|
|
333
|
-
console.error("[jsxgrid] jsgrid.field.Xcheckbox.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
334
|
-
}
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
339
|
+
(function(jsGrid, $, undefined) {
|
|
340
|
+
|
|
341
|
+
if (!jsGrid) {
|
|
342
|
+
if (window.console) {
|
|
343
|
+
console.error("[jsxgrid] jsgrid.field.Xcheckbox.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
344
|
+
}
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
337
347
|
|
|
338
348
|
|
|
339
349
|
// Standalone: does not extend jsGrid.CheckboxField, only jsGrid.Field.
|
|
@@ -351,6 +361,7 @@
|
|
|
351
361
|
align: "center",
|
|
352
362
|
autosearch: true,
|
|
353
363
|
defaultSelected: null,//value (0/1/true/false) to preset the filter checkbox with, applied once on first filter render then reset
|
|
364
|
+
defaultValue: null,//value (0/1/true/false) to prefill the insert row checkbox with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
354
365
|
|
|
355
366
|
filterTemplate: function () {
|
|
356
367
|
if (!this.filtering)
|
|
@@ -408,7 +419,11 @@
|
|
|
408
419
|
if (!this.inserting)
|
|
409
420
|
return "";
|
|
410
421
|
|
|
411
|
-
|
|
422
|
+
var $result = this.insertControl = this._createCheckbox();
|
|
423
|
+
if (this.defaultValue !== null) {
|
|
424
|
+
$result.prop("checked", !!this.defaultValue);
|
|
425
|
+
}
|
|
426
|
+
return $result;
|
|
412
427
|
},
|
|
413
428
|
|
|
414
429
|
insertValue: function () {
|
|
@@ -442,14 +457,14 @@
|
|
|
442
457
|
jsGrid.fields.Xcheckbox = Xcheckbox;
|
|
443
458
|
|
|
444
459
|
}(window.jsGrid, window.jQuery));
|
|
445
|
-
(function(jsGrid, $, undefined) {
|
|
446
|
-
|
|
447
|
-
if (!jsGrid) {
|
|
448
|
-
if (window.console) {
|
|
449
|
-
console.error("[jsxgrid] jsgrid.field.XimgField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
450
|
-
}
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
460
|
+
(function(jsGrid, $, undefined) {
|
|
461
|
+
|
|
462
|
+
if (!jsGrid) {
|
|
463
|
+
if (window.console) {
|
|
464
|
+
console.error("[jsxgrid] jsgrid.field.XimgField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
465
|
+
}
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
453
468
|
|
|
454
469
|
|
|
455
470
|
// Standalone: does not extend jsGrid.TextField, only jsGrid.Field.
|
|
@@ -466,6 +481,7 @@
|
|
|
466
481
|
fm_callback: null,
|
|
467
482
|
editButtonText: 'Open FM',
|
|
468
483
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
484
|
+
defaultValue: null,//value to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
469
485
|
|
|
470
486
|
filterTemplate: function () {
|
|
471
487
|
if (!this.filtering)
|
|
@@ -522,7 +538,7 @@
|
|
|
522
538
|
return "";
|
|
523
539
|
var fm = this.fm_callback;
|
|
524
540
|
|
|
525
|
-
var insertControl = this.insertControl = $('<input type="text">');
|
|
541
|
+
var insertControl = this.insertControl = $('<input type="text">').val(this.defaultValue || '');
|
|
526
542
|
if (typeof fm == 'function') {
|
|
527
543
|
return $('<button class="jsgrid-imgField-button">'+this.editButtonText+'</button>').click(function () {
|
|
528
544
|
fm(insertControl);
|
|
@@ -549,14 +565,14 @@
|
|
|
549
565
|
jsGrid.fields.XimgField = XimgField;
|
|
550
566
|
|
|
551
567
|
}(window.jsGrid, window.jQuery));
|
|
552
|
-
(function(jsGrid, $, undefined) {
|
|
553
|
-
|
|
554
|
-
if (!jsGrid) {
|
|
555
|
-
if (window.console) {
|
|
556
|
-
console.error("[jsxgrid] jsgrid.field.Xselect.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
557
|
-
}
|
|
558
|
-
return;
|
|
559
|
-
}
|
|
568
|
+
(function(jsGrid, $, undefined) {
|
|
569
|
+
|
|
570
|
+
if (!jsGrid) {
|
|
571
|
+
if (window.console) {
|
|
572
|
+
console.error("[jsxgrid] jsgrid.field.Xselect.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
573
|
+
}
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
560
576
|
|
|
561
577
|
|
|
562
578
|
// Standalone: does not extend jsGrid.SelectField, only jsGrid.Field.
|
|
@@ -586,7 +602,8 @@
|
|
|
586
602
|
valueType: NUMBER_VALUE_TYPE,
|
|
587
603
|
pseudoElement: null,//pseudoElement that will be unsifted to start of select data in filters
|
|
588
604
|
select2: null,
|
|
589
|
-
defaultSelected: null,
|
|
605
|
+
defaultSelected: null,//value to preselect in the filter, applied once on first filter render then reset
|
|
606
|
+
defaultValue: null,//value to preselect in the insert row, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
590
607
|
|
|
591
608
|
itemTemplate: function (value) {
|
|
592
609
|
var items = this.items,
|
|
@@ -615,7 +632,11 @@
|
|
|
615
632
|
if (!this.inserting)
|
|
616
633
|
return "";
|
|
617
634
|
|
|
618
|
-
|
|
635
|
+
var $result = this.insertControl = this._createSelect();
|
|
636
|
+
if (this.defaultValue !== null) {
|
|
637
|
+
$result.val(this.defaultValue);
|
|
638
|
+
}
|
|
639
|
+
return $result;
|
|
619
640
|
},
|
|
620
641
|
|
|
621
642
|
editTemplate: function (value) {
|
|
@@ -733,14 +754,14 @@
|
|
|
733
754
|
jsGrid.fields.Xselect = Xselect;
|
|
734
755
|
|
|
735
756
|
}(window.jsGrid, window.jQuery));
|
|
736
|
-
(function(jsGrid, $, undefined) {
|
|
737
|
-
|
|
738
|
-
if (!jsGrid) {
|
|
739
|
-
if (window.console) {
|
|
740
|
-
console.error("[jsxgrid] jsgrid.field.Xtextarea.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
741
|
-
}
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
757
|
+
(function(jsGrid, $, undefined) {
|
|
758
|
+
|
|
759
|
+
if (!jsGrid) {
|
|
760
|
+
if (window.console) {
|
|
761
|
+
console.error("[jsxgrid] jsgrid.field.Xtextarea.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
762
|
+
}
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
744
765
|
|
|
745
766
|
|
|
746
767
|
// Standalone: does not extend jsGrid.TextAreaField, only jsGrid.Field.
|
|
@@ -756,6 +777,7 @@
|
|
|
756
777
|
readOnly: false,
|
|
757
778
|
maxShowSymbols: 50,
|
|
758
779
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
780
|
+
defaultValue: null,//value to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
759
781
|
|
|
760
782
|
filterTemplate: function () {
|
|
761
783
|
if (!this.filtering)
|
|
@@ -789,7 +811,11 @@
|
|
|
789
811
|
if (!this.inserting)
|
|
790
812
|
return "";
|
|
791
813
|
|
|
792
|
-
|
|
814
|
+
var $result = this.insertControl = this._createTextArea();
|
|
815
|
+
if (this.defaultValue !== null) {
|
|
816
|
+
$result.val(this.defaultValue);
|
|
817
|
+
}
|
|
818
|
+
return $result;
|
|
793
819
|
},
|
|
794
820
|
|
|
795
821
|
editTemplate: function (value) {
|
|
@@ -838,14 +864,14 @@
|
|
|
838
864
|
jsGrid.fields.Xtextarea = Xtextarea;
|
|
839
865
|
|
|
840
866
|
}(window.jsGrid, window.jQuery));
|
|
841
|
-
(function(jsGrid, $, undefined) {
|
|
842
|
-
|
|
843
|
-
if (!jsGrid) {
|
|
844
|
-
if (window.console) {
|
|
845
|
-
console.error("[jsxgrid] jsgrid.field.Xjsoneditor.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
846
|
-
}
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
867
|
+
(function(jsGrid, $, undefined) {
|
|
868
|
+
|
|
869
|
+
if (!jsGrid) {
|
|
870
|
+
if (window.console) {
|
|
871
|
+
console.error("[jsxgrid] jsgrid.field.Xjsoneditor.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
872
|
+
}
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
849
875
|
|
|
850
876
|
|
|
851
877
|
// Standalone: does not extend jsGrid.TextAreaField, only jsGrid.Field.
|
|
@@ -863,6 +889,7 @@
|
|
|
863
889
|
closeText: 'Save',
|
|
864
890
|
editText: "Editor",
|
|
865
891
|
defaultSelected: null,//value to preset the filter input with, applied once on first filter render then reset
|
|
892
|
+
defaultValue: null,//JSON value (object, or already-stringified) to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
866
893
|
|
|
867
894
|
filterTemplate: function () {
|
|
868
895
|
if (!this.filtering)
|
|
@@ -954,7 +981,12 @@
|
|
|
954
981
|
|
|
955
982
|
var f = this;
|
|
956
983
|
|
|
957
|
-
|
|
984
|
+
var $textarea = $("<textarea>");
|
|
985
|
+
if (this.defaultValue !== null) {
|
|
986
|
+
$textarea.val(typeof this.defaultValue === 'string' ? this.defaultValue : JSON.stringify(this.defaultValue));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
return this.insertControl = $textarea.click(function () {
|
|
958
990
|
var editor = f._createJsonEditor({}, 'tree');
|
|
959
991
|
var ta = $(this);
|
|
960
992
|
|
|
@@ -1081,14 +1113,14 @@
|
|
|
1081
1113
|
jsGrid.fields.XRowSelectField = XRowSelectField;
|
|
1082
1114
|
|
|
1083
1115
|
}(window.jsGrid, window.jQuery));
|
|
1084
|
-
(function(jsGrid, $, undefined) {
|
|
1085
|
-
|
|
1086
|
-
if (!jsGrid) {
|
|
1087
|
-
if (window.console) {
|
|
1088
|
-
console.error("[jsxgrid] jsgrid.field.XDateTimeField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
1089
|
-
}
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1116
|
+
(function(jsGrid, $, undefined) {
|
|
1117
|
+
|
|
1118
|
+
if (!jsGrid) {
|
|
1119
|
+
if (window.console) {
|
|
1120
|
+
console.error("[jsxgrid] jsgrid.field.XDateTimeField.js was loaded before the jsxgrid engine (jsxgrid.js) - include the engine first.");
|
|
1121
|
+
}
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1092
1124
|
|
|
1093
1125
|
var XDateTimeField = function (config) {
|
|
1094
1126
|
jsGrid.Field.call(this, config);
|
|
@@ -1100,6 +1132,7 @@
|
|
|
1100
1132
|
datePickerType: "datetime-local",
|
|
1101
1133
|
dateRange: false,
|
|
1102
1134
|
defaultSelected: null,//value (or {from, to} when dateRange is true) to preset the filter with, applied once on first filter render then reset
|
|
1135
|
+
defaultValue: null,//value (matching datePickerType's input format) to prefill the insert row with, applied every time a fresh insert row is built (not reset after use, unlike defaultSelected)
|
|
1103
1136
|
sorter: function (date1, date2) {
|
|
1104
1137
|
return new Date(date1) - new Date(date2);
|
|
1105
1138
|
},
|
|
@@ -1189,7 +1222,7 @@
|
|
|
1189
1222
|
},
|
|
1190
1223
|
|
|
1191
1224
|
insertTemplate: function () {
|
|
1192
|
-
return this._insertPicker = this._createPicker();
|
|
1225
|
+
return this._insertPicker = this._createPicker().val(this.defaultValue || '');
|
|
1193
1226
|
},
|
|
1194
1227
|
|
|
1195
1228
|
editTemplate: function (value) {
|