@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
|
@@ -3075,6 +3075,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3075
3075
|
const key = control.grid.getPrimaryKeyFieldNames()[0];
|
|
3076
3076
|
const treeData = control.dataSource instanceof DataManager ?
|
|
3077
3077
|
control.dataSource.dataSource.json : control.dataSource;
|
|
3078
|
+
const gridData = control.grid.dataSource;
|
|
3078
3079
|
let modifiedData = [];
|
|
3079
3080
|
const originalData = value;
|
|
3080
3081
|
let isSkip = false;
|
|
@@ -3102,9 +3103,9 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3102
3103
|
const keys = modifiedData[parseInt(k.toString(), 10)].taskData ?
|
|
3103
3104
|
Object.keys(modifiedData[parseInt(k.toString(), 10)].taskData) :
|
|
3104
3105
|
Object.keys(modifiedData[parseInt(k.toString(), 10)]);
|
|
3105
|
-
i = treeData.length;
|
|
3106
|
+
i = treeData.length === 0 && gridData.length === 1 ? gridData.length : treeData.length;
|
|
3106
3107
|
while (i-- && i >= 0) {
|
|
3107
|
-
if (treeData[parseInt(i.toString(), 10)][`${key}`] === modifiedData[parseInt(k.toString(), 10)][`${key}`]) {
|
|
3108
|
+
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}`]) {
|
|
3108
3109
|
if (action === 'delete') {
|
|
3109
3110
|
const currentData = treeData[parseInt(i.toString(), 10)];
|
|
3110
3111
|
treeData.splice(i, 1);
|
|
@@ -3148,7 +3149,10 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
|
|
|
3148
3149
|
else if (action === 'add' || action === 'batchsave') {
|
|
3149
3150
|
let index;
|
|
3150
3151
|
if (control.editSettings.newRowPosition === 'Child') {
|
|
3151
|
-
if (
|
|
3152
|
+
if (treeData.length === 0 && gridData.length === 1) {
|
|
3153
|
+
treeData.push(originalData.taskData);
|
|
3154
|
+
}
|
|
3155
|
+
else if (isSelfReference) {
|
|
3152
3156
|
originalData.taskData[`${control.parentIdMapping}`] = treeData[parseInt(i.toString(), 10)][`${control.idMapping}`];
|
|
3153
3157
|
treeData.splice(i + 1, 0, originalData.taskData);
|
|
3154
3158
|
}
|
|
@@ -3223,6 +3227,9 @@ function addAction(details, treeData, control, isSelfReference, addRowIndex, sel
|
|
|
3223
3227
|
value = extend$1({}, addRowRecord);
|
|
3224
3228
|
value = getPlainData(value);
|
|
3225
3229
|
}
|
|
3230
|
+
else if (currentViewRecords.length === 0) {
|
|
3231
|
+
value = getPlainData(value);
|
|
3232
|
+
}
|
|
3226
3233
|
else {
|
|
3227
3234
|
value = extend$1({}, currentViewRecords[addRowIndex + 1]);
|
|
3228
3235
|
value = getPlainData(value);
|
|
@@ -3236,8 +3243,8 @@ function addAction(details, treeData, control, isSelfReference, addRowIndex, sel
|
|
|
3236
3243
|
}
|
|
3237
3244
|
else {
|
|
3238
3245
|
const primaryKeys = control.grid.getPrimaryKeyFieldNames()[0];
|
|
3239
|
-
const currentdata = currentViewRecords[parseInt(addRowIndex.toString(), 10)];
|
|
3240
|
-
if (!isNullOrUndefined(currentdata) && currentdata[`${primaryKeys}`] === details.value[`${primaryKeys}`] || selectedIndex !== -1) {
|
|
3246
|
+
const currentdata = currentViewRecords.length > 0 ? currentViewRecords[parseInt(addRowIndex.toString(), 10)] : [];
|
|
3247
|
+
if (!isNullOrUndefined(currentdata) && currentdata[`${primaryKeys}`] === details.value[`${primaryKeys}`] || selectedIndex !== -1 && treeData.length !== 0) {
|
|
3241
3248
|
value = extend$1({}, currentdata);
|
|
3242
3249
|
}
|
|
3243
3250
|
else {
|
|
@@ -4296,6 +4303,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
4296
4303
|
if (this.isIndentEnabled) {
|
|
4297
4304
|
this.refreshToolbarItems();
|
|
4298
4305
|
}
|
|
4306
|
+
this.updateColumnModel();
|
|
4299
4307
|
this.wireEvents();
|
|
4300
4308
|
this.renderComplete();
|
|
4301
4309
|
const destroyTemplate = 'destroyTemplate';
|
|
@@ -12475,7 +12483,7 @@ class BatchEdit {
|
|
|
12475
12483
|
}
|
|
12476
12484
|
else {
|
|
12477
12485
|
const totalRecords = extendArray(data);
|
|
12478
|
-
if (totalRecords.length) {
|
|
12486
|
+
if (totalRecords.length && currentViewRecords.length !== 0) {
|
|
12479
12487
|
const startIndex = totalRecords.map((e) => { return e[`${primarykey}`]; })
|
|
12480
12488
|
.indexOf(currentViewRecords[0][`${primarykey}`]);
|
|
12481
12489
|
const endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
|
|
@@ -13346,6 +13354,9 @@ class Edit {
|
|
|
13346
13354
|
// }
|
|
13347
13355
|
// }
|
|
13348
13356
|
beginEdit(args) {
|
|
13357
|
+
if (this.parent.flatData.length === 0 && !isNullOrUndefined(this.addRowRecord)) {
|
|
13358
|
+
this.addRowRecord = undefined;
|
|
13359
|
+
}
|
|
13349
13360
|
if (args.requestType === 'refresh' && this.isOnBatch) {
|
|
13350
13361
|
args.cancel = true;
|
|
13351
13362
|
return;
|