@syncfusion/ej2-treegrid 31.2.10 → 31.2.15
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/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +17 -6
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +17 -6
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/treegrid/actions/batch-edit.js +1 -1
- package/src/treegrid/actions/crud-actions.js +12 -5
- package/src/treegrid/actions/edit.js +3 -0
- package/src/treegrid/base/treegrid.js +1 -0
|
@@ -3329,6 +3329,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3329
3329
|
var key = control.grid.getPrimaryKeyFieldNames()[0];
|
|
3330
3330
|
var treeData = control.dataSource instanceof DataManager ?
|
|
3331
3331
|
control.dataSource.dataSource.json : control.dataSource;
|
|
3332
|
+
var gridData = control.grid.dataSource;
|
|
3332
3333
|
var modifiedData = [];
|
|
3333
3334
|
var originalData = value;
|
|
3334
3335
|
var isSkip = false;
|
|
@@ -3356,9 +3357,9 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3356
3357
|
var keys = modifiedData[parseInt(k.toString(), 10)].taskData ?
|
|
3357
3358
|
Object.keys(modifiedData[parseInt(k.toString(), 10)].taskData) :
|
|
3358
3359
|
Object.keys(modifiedData[parseInt(k.toString(), 10)]);
|
|
3359
|
-
i = treeData.length;
|
|
3360
|
+
i = treeData.length === 0 && gridData.length === 1 ? gridData.length : treeData.length;
|
|
3360
3361
|
var _loop_1 = function () {
|
|
3361
|
-
if (treeData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) {
|
|
3362
|
+
if ((treeData.length === 0 && gridData.length === 1 && gridData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) || treeData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) {
|
|
3362
3363
|
if (action === 'delete') {
|
|
3363
3364
|
var currentData_1 = treeData[parseInt(i.toString(), 10)];
|
|
3364
3365
|
treeData.splice(i, 1);
|
|
@@ -3404,7 +3405,10 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3404
3405
|
else if (action === 'add' || action === 'batchsave') {
|
|
3405
3406
|
var index = void 0;
|
|
3406
3407
|
if (control.editSettings.newRowPosition === 'Child') {
|
|
3407
|
-
if (
|
|
3408
|
+
if (treeData.length === 0 && gridData.length === 1) {
|
|
3409
|
+
treeData.push(originalData.taskData);
|
|
3410
|
+
}
|
|
3411
|
+
else if (isSelfReference) {
|
|
3408
3412
|
originalData.taskData["" + control.parentIdMapping] = treeData[parseInt(i.toString(), 10)]["" + control.idMapping];
|
|
3409
3413
|
treeData.splice(i + 1, 0, originalData.taskData);
|
|
3410
3414
|
}
|
|
@@ -3484,6 +3488,9 @@ function addAction(details, treeData, control, isSelfReference, addRowIndex, sel
|
|
|
3484
3488
|
value = extend$1({}, addRowRecord);
|
|
3485
3489
|
value = getPlainData(value);
|
|
3486
3490
|
}
|
|
3491
|
+
else if (currentViewRecords.length === 0) {
|
|
3492
|
+
value = getPlainData(value);
|
|
3493
|
+
}
|
|
3487
3494
|
else {
|
|
3488
3495
|
value = extend$1({}, currentViewRecords[addRowIndex + 1]);
|
|
3489
3496
|
value = getPlainData(value);
|
|
@@ -3497,8 +3504,8 @@ function addAction(details, treeData, control, isSelfReference, addRowIndex, sel
|
|
|
3497
3504
|
}
|
|
3498
3505
|
else {
|
|
3499
3506
|
var primaryKeys = control.grid.getPrimaryKeyFieldNames()[0];
|
|
3500
|
-
var currentdata = currentViewRecords[parseInt(addRowIndex.toString(), 10)];
|
|
3501
|
-
if (!isNullOrUndefined(currentdata) && currentdata["" + primaryKeys] === details.value["" + primaryKeys] || selectedIndex !== -1) {
|
|
3507
|
+
var currentdata = currentViewRecords.length > 0 ? currentViewRecords[parseInt(addRowIndex.toString(), 10)] : [];
|
|
3508
|
+
if (!isNullOrUndefined(currentdata) && currentdata["" + primaryKeys] === details.value["" + primaryKeys] || selectedIndex !== -1 && treeData.length !== 0) {
|
|
3502
3509
|
value = extend$1({}, currentdata);
|
|
3503
3510
|
}
|
|
3504
3511
|
else {
|
|
@@ -4610,6 +4617,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
4610
4617
|
if (this.isIndentEnabled) {
|
|
4611
4618
|
this.refreshToolbarItems();
|
|
4612
4619
|
}
|
|
4620
|
+
this.updateColumnModel();
|
|
4613
4621
|
this.wireEvents();
|
|
4614
4622
|
this.renderComplete();
|
|
4615
4623
|
var destroyTemplate = 'destroyTemplate';
|
|
@@ -12926,7 +12934,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
12926
12934
|
}
|
|
12927
12935
|
else {
|
|
12928
12936
|
var totalRecords = extendArray(data);
|
|
12929
|
-
if (totalRecords.length) {
|
|
12937
|
+
if (totalRecords.length && currentViewRecords.length !== 0) {
|
|
12930
12938
|
var startIndex = totalRecords.map(function (e) { return e["" + primarykey_1]; })
|
|
12931
12939
|
.indexOf(currentViewRecords[0]["" + primarykey_1]);
|
|
12932
12940
|
var endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
|
|
@@ -13803,6 +13811,9 @@ var Edit = /** @__PURE__ @class */ (function () {
|
|
|
13803
13811
|
// }
|
|
13804
13812
|
// }
|
|
13805
13813
|
Edit.prototype.beginEdit = function (args) {
|
|
13814
|
+
if (this.parent.flatData.length === 0 && !isNullOrUndefined(this.addRowRecord)) {
|
|
13815
|
+
this.addRowRecord = undefined;
|
|
13816
|
+
}
|
|
13806
13817
|
if (args.requestType === 'refresh' && this.isOnBatch) {
|
|
13807
13818
|
args.cancel = true;
|
|
13808
13819
|
return;
|