@syncfusion/ej2-treegrid
Advanced tools
Comparing version 16.4.53 to 16.4.55
@@ -9,3 +9,14 @@ # Changelog | ||
- Change detection for properties `dataSource` and `query` were handled for remote data. | ||
- Edited records can be searched/filtered. | ||
- Inner level records will be collapsed/expanded after filtering/searching actions. | ||
## 16.4.53 (2019-02-13) | ||
### TreeGrid | ||
#### Bug Fixes | ||
- Child records of third level or its successor displays properly based on their hierarchy relation in self reference data binding. | ||
- Change detection works fine for `dataSource` property. | ||
@@ -12,0 +23,0 @@ ## 16.4.52 (2019-02-05) |
/*! | ||
* filename: index.d.ts | ||
* version : 16.4.53 | ||
* version : 16.4.55 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-treegrid", | ||
"version": "16.4.53", | ||
"version": "16.4.55", | ||
"description": "Essential JS 2 TreeGrid Component", | ||
@@ -13,4 +13,4 @@ "author": "Syncfusion Inc.", | ||
"@syncfusion/ej2-data": "~16.4.52", | ||
"@syncfusion/ej2-popups": "~16.4.53", | ||
"@syncfusion/ej2-grids": "~16.4.53" | ||
"@syncfusion/ej2-popups": "~16.4.54", | ||
"@syncfusion/ej2-grids": "~16.4.55" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
@@ -18,2 +18,3 @@ import { TreeGrid } from '../base'; | ||
private contextMenuOpen; | ||
private contextMenuClick; | ||
/** | ||
@@ -20,0 +21,0 @@ * For internal use only - Get the module name. |
@@ -17,2 +17,3 @@ import { Grid, ContextMenu as cmenu } from '@syncfusion/ej2-grids'; | ||
this.parent.on('contextMenuOpen', this.contextMenuOpen, this); | ||
this.parent.on('contextMenuClick', this.contextMenuClick, this); | ||
}; | ||
@@ -27,2 +28,3 @@ /** | ||
this.parent.off('contextMenuOpen', this.contextMenuOpen); | ||
this.parent.off('contextMenuClick', this.contextMenuClick); | ||
}; | ||
@@ -40,2 +42,9 @@ ContextMenu.prototype.contextMenuOpen = function (args) { | ||
}; | ||
ContextMenu.prototype.contextMenuClick = function (args) { | ||
if (args.item.id === 'Above' || args.item.id === 'Below') { | ||
this.parent.notify('savePreviousRowPosition', args); | ||
this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true); | ||
this.parent.addRecord(); | ||
} | ||
}; | ||
/** | ||
@@ -42,0 +51,0 @@ * For internal use only - Get the module name. |
@@ -15,2 +15,3 @@ import { Column } from '@syncfusion/ej2-grids'; | ||
private doubleClickTarget; | ||
private previousNewRowPosition; | ||
/** | ||
@@ -52,2 +53,3 @@ * Constructor for Edit module | ||
private beginEdit; | ||
private savePreviousRowPosition; | ||
private beginAddEdit; | ||
@@ -54,0 +56,0 @@ private addAction; |
@@ -22,2 +22,3 @@ import { Grid, Edit as GridEdit, getUid, getObject } from '@syncfusion/ej2-grids'; | ||
// this.isAdd = false; | ||
this.previousNewRowPosition = null; | ||
this.addEventListener(); | ||
@@ -45,2 +46,3 @@ } | ||
this.parent.grid.on(events.doubleTap, this.recordDoubleClick, this); | ||
this.parent.on('savePreviousRowPosition', this.savePreviousRowPosition, this); | ||
// this.parent.on(events.beforeDataBound, this.beforeDataBound, this); | ||
@@ -70,2 +72,3 @@ // this.parent.on(events.cellSaved, this.cellSaved, this); | ||
this.parent.grid.off(events.doubleTap, this.recordDoubleClick); | ||
this.parent.off('savePreviousRowPosition', this.savePreviousRowPosition); | ||
}; | ||
@@ -296,2 +299,7 @@ /** | ||
}; | ||
Edit.prototype.savePreviousRowPosition = function (args) { | ||
if (this.previousNewRowPosition === null) { | ||
this.previousNewRowPosition = this.parent.editSettings.newRowPosition; | ||
} | ||
}; | ||
Edit.prototype.beginAddEdit = function (args) { | ||
@@ -310,3 +318,2 @@ var value = args.data; | ||
var idMapping = void 0; | ||
var parentIndex = void 0; | ||
var parentUniqueID = void 0; | ||
@@ -319,3 +326,2 @@ var parentItem = void 0; | ||
idMapping = currentData[this.addRowIndex][this.parent.idMapping]; | ||
parentIndex = currentData[this.addRowIndex].parentIndex; | ||
parentIdMapping = currentData[this.addRowIndex][this.parent.parentIdMapping]; | ||
@@ -338,3 +344,2 @@ if (currentData[this.addRowIndex].parentItem) { | ||
if (this.selectedIndex > -1) { | ||
value.parentIndex = dataIndex; | ||
value.parentItem = extend({}, currentData[this.addRowIndex]); | ||
@@ -349,3 +354,3 @@ value.parentUniqueID = value.parentItem.uniqueID; | ||
value[this.parent.parentIdMapping] = idMapping; | ||
if (!isNullOrUndefined(value.parentIndex)) { | ||
if (!isNullOrUndefined(value.parentItem)) { | ||
this.updateParentRow(key, value.parentItem, 'add', value); | ||
@@ -357,3 +362,2 @@ } | ||
if (this.selectedIndex > -1 && level) { | ||
value.parentIndex = parentIndex; | ||
value.parentUniqueID = parentUniqueID; | ||
@@ -367,3 +371,3 @@ value.parentItem = extend({}, parentItem); | ||
value[this.parent.parentIdMapping] = parentIdMapping; | ||
if (!isNullOrUndefined(value.parentIndex)) { | ||
if (!isNullOrUndefined(value.parentItem)) { | ||
this.updateParentRow(key, value.parentItem, 'add', value); | ||
@@ -525,2 +529,6 @@ } | ||
} | ||
if (action === 'add' && this.previousNewRowPosition != null) { | ||
this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true); | ||
this.previousNewRowPosition = null; | ||
} | ||
}; | ||
@@ -527,0 +535,0 @@ Edit.prototype.removeChildRecords = function (childRecords, modifiedData, action, key, originalData, columnName) { |
@@ -12,3 +12,2 @@ import { TreeGrid } from '../base/treegrid'; | ||
private isHierarchyFilter; | ||
private filterRootIndex; | ||
/** | ||
@@ -15,0 +14,0 @@ * Constructor for Filter module |
@@ -18,3 +18,2 @@ import { getObject, Filter as GridFilter, Grid } from '@syncfusion/ej2-grids'; | ||
this.filteredParentRecs = []; | ||
this.filterRootIndex = -1; | ||
this.addEventListener(); | ||
@@ -166,8 +165,5 @@ } | ||
setValue('filterLevel', parent_3.filterLevel + 1, record[c]); | ||
record[c].filterRootIndex = this_2.filterRootIndex; | ||
} | ||
else { | ||
setValue('filterLevel', 0, record[c]); | ||
this_2.filterRootIndex = record[c].filterIndex = c; | ||
record[c].filterIndex = this_2.filterRootIndex; | ||
this_2.filteredParentRecs.push(record[c]); | ||
@@ -189,10 +185,6 @@ } | ||
var fLevel = getObject('filterLevel', currentRecord); | ||
if (fLevel || fLevel === 0) { | ||
if (fLevel || fLevel === 0 || !isNullOrUndefined(getObject('hasFilteredChildRecords', currentRecord))) { | ||
var ischild = getObject('childRecords', currentRecord); | ||
if (!isNullOrUndefined(ischild) && ischild.length) { | ||
setValue('hasFilteredChildRecords', true, currentRecord); | ||
} | ||
setValue('hasFilteredChildRecords', null, currentRecord); | ||
setValue('filterLevel', null, currentRecord); | ||
setValue('filterIndex', null, currentRecord); | ||
setValue('filterRootIndex', null, currentRecord); | ||
} | ||
@@ -199,0 +191,0 @@ } |
@@ -49,3 +49,4 @@ import { TreeGrid } from '../base'; | ||
private collapseExpandPagedchilds; | ||
private pageRoot; | ||
private pageAction; | ||
} |
@@ -86,2 +86,20 @@ import { Grid } from '@syncfusion/ej2-grids'; | ||
}; | ||
Page.prototype.pageRoot = function (pagedResults, temp, result) { | ||
var newResults = isNullOrUndefined(result) ? [] : result; | ||
var _loop_1 = function (t) { | ||
newResults.push(temp[t]); | ||
var res = []; | ||
if (temp[t].hasChildRecords) { | ||
res = pagedResults.filter(function (e) { | ||
return temp[t].uniqueID === e.parentUniqueID; | ||
}); | ||
newResults = this_1.pageRoot(pagedResults, res, newResults); | ||
} | ||
}; | ||
var this_1 = this; | ||
for (var t = 0; t < temp.length; t++) { | ||
_loop_1(t); | ||
} | ||
return newResults; | ||
}; | ||
Page.prototype.pageAction = function (pageingDetails) { | ||
@@ -91,3 +109,3 @@ var _this = this; | ||
if (this.parent.pageSettings.pageSizeMode === 'Root') { | ||
var temp_1 = []; | ||
var temp = []; | ||
var propname = (this.parent.grid.filterSettings.columns.length > 0) && | ||
@@ -97,4 +115,4 @@ (this.parent.filterSettings.hierarchyMode === 'Child' || this.parent.filterSettings.hierarchyMode === 'None') ? | ||
var query = new Query().where(propname, 'equal', 0); | ||
temp_1 = dm.executeLocal(query); | ||
pageingDetails.count = temp_1.length; | ||
temp = dm.executeLocal(query); | ||
pageingDetails.count = temp.length; | ||
var size = this.parent.grid.pageSettings.pageSize; | ||
@@ -104,21 +122,5 @@ var current = this.parent.grid.pageSettings.currentPage; | ||
query = query.skip(skip).take(size); | ||
temp_1 = dm.executeLocal(query); | ||
var child = []; | ||
var _loop_1 = function (r) { | ||
child = pageingDetails.result.filter(function (e) { | ||
if (!isNullOrUndefined(temp_1[r].filterIndex)) { | ||
return e.filterRootIndex === temp_1[r].filterIndex; | ||
} | ||
else { | ||
return e.rootIndex === temp_1[r].index; | ||
} | ||
}); | ||
for (var c = 0; c < child.length; c++) { | ||
temp_1.splice(r + c + 1, 0, child[c]); | ||
} | ||
}; | ||
for (var r = 0; r < temp_1.length; r++) { | ||
_loop_1(r); | ||
} | ||
pageingDetails.result = temp_1; | ||
temp = dm.executeLocal(query); | ||
var newResults = this.pageRoot(pageingDetails.result, temp); | ||
pageingDetails.result = newResults; | ||
} | ||
@@ -125,0 +127,0 @@ else { |
@@ -13,3 +13,2 @@ import { TreeGrid } from '../base/treegrid'; | ||
private isSelfReference; | ||
private rootIndex; | ||
constructor(grid: TreeGrid); | ||
@@ -16,0 +15,0 @@ /** |
@@ -15,3 +15,2 @@ import { isNullOrUndefined, extend } from '@syncfusion/ej2-base'; | ||
this.storedIndex = -1; | ||
this.rootIndex = -1; | ||
this.isSelfReference = !isNullOrUndefined(this.parent.parentIdMapping); | ||
@@ -77,11 +76,4 @@ this.addEventListener(); | ||
level = parentRecords.level + 1; | ||
currentSortData.parentIndex = parentIndex; | ||
} | ||
currentSortData.level = level; | ||
if (isNullOrUndefined(currentSortData.parentIndex)) { | ||
this.rootIndex = currentSortData.index; | ||
} | ||
else { | ||
currentSortData.rootIndex = this.rootIndex; | ||
} | ||
if (isNullOrUndefined(currentSortData[this.parent.parentIdMapping]) || | ||
@@ -93,3 +85,3 @@ currentSortData.parentItem) { | ||
this.createSortRecords({ modifiedData: currentSortData[this.parent.childMapping], parentRecords: currentSortData, | ||
parentIndex: this.storedIndex, filteredResult: filteredResult }); | ||
filteredResult: filteredResult }); | ||
} | ||
@@ -96,0 +88,0 @@ } |
@@ -80,3 +80,2 @@ import { Query, DataManager } from '@syncfusion/ej2-data'; | ||
var index = getObject('index', summaryParent); | ||
setValue('parentIndex', index, item); | ||
setValue('isSummaryRow', true, item); | ||
@@ -83,0 +82,0 @@ if (isSort) { |
@@ -48,2 +48,6 @@ /** | ||
/** @hidden */ | ||
export declare const contextMenuClick: string; | ||
/** @hidden */ | ||
export declare const savePreviousRowPosition: string; | ||
/** @hidden */ | ||
export declare const crudAction: string; | ||
@@ -50,0 +54,0 @@ /** @hidden */ |
@@ -48,2 +48,6 @@ /** | ||
/** @hidden */ | ||
export var contextMenuClick = 'contextMenuClick'; | ||
/** @hidden */ | ||
export var savePreviousRowPosition = 'savePreviousRowPosition'; | ||
/** @hidden */ | ||
export var crudAction = 'crudAction'; | ||
@@ -50,0 +54,0 @@ /** @hidden */ |
@@ -13,3 +13,2 @@ import { TreeGrid } from './treegrid'; | ||
private parent; | ||
private rootIndex; | ||
private dataResults; | ||
@@ -16,0 +15,0 @@ private sortedData; |
@@ -18,3 +18,2 @@ import { extend, isNullOrUndefined, setValue, getValue } from '@syncfusion/ej2-base'; | ||
this.hierarchyData = []; | ||
this.rootIndex = -1; | ||
this.storedIndex = -1; | ||
@@ -141,3 +140,8 @@ this.sortedData = []; | ||
} | ||
this.createRecords(this.hierarchyData); | ||
if (!Object.keys(this.hierarchyData).length) { | ||
this.parent.flatData = []; | ||
} | ||
else { | ||
this.createRecords(this.hierarchyData); | ||
} | ||
this.storedIndex = -1; | ||
@@ -235,3 +239,2 @@ } | ||
result[r].parentItem = rowDetails.record; | ||
result[r].parentIndex = rowDetails.record.index; | ||
if ((result[r][_this.parent.hasChildMapping] || _this.parentItems.indexOf(result[r][_this.parent.idMapping]) !== -1) | ||
@@ -257,3 +260,3 @@ && !(haveChild && !haveChild[r])) { | ||
}; | ||
DataManipulation.prototype.createRecords = function (data, parentRecords, parentIndex) { | ||
DataManipulation.prototype.createRecords = function (data, parentRecords) { | ||
for (var i = 0, len = Object.keys(data).length; i < len; i++) { | ||
@@ -282,21 +285,11 @@ var currentData = data[i]; | ||
level = parentRecords.level + 1; | ||
currentData.parentIndex = parentIndex; | ||
} | ||
currentData.level = level; | ||
if (isNullOrUndefined(currentData.parentIndex)) { | ||
this.rootIndex = currentData.index; | ||
} | ||
else { | ||
currentData.rootIndex = this.rootIndex; | ||
} | ||
if (isNullOrUndefined(currentData[this.parent.parentIdMapping]) || currentData.parentItem) { | ||
this.parent.flatData.push(currentData); | ||
} | ||
if (!isNullOrUndefined(currentData[this.parent.childMapping])) { | ||
this.createRecords(currentData[this.parent.childMapping], currentData, this.storedIndex); | ||
if (!isNullOrUndefined(currentData[this.parent.childMapping] && currentData[this.parent.childMapping].length)) { | ||
this.createRecords(currentData[this.parent.childMapping], currentData); | ||
} | ||
} | ||
if (!Object.keys(data).length) { | ||
this.parent.flatData = []; | ||
} | ||
}; | ||
@@ -330,4 +323,5 @@ DataManipulation.prototype.sortedRecords = function (data) { | ||
DataManipulation.prototype.dataProcessor = function (args) { | ||
var results = this.parent.flatData; | ||
var count = this.parent.flatData.length; | ||
var dataObj = this.parent.grid.dataSource; | ||
var results = dataObj instanceof DataManager ? dataObj.dataSource.json : dataObj; | ||
var count = results.length; | ||
if ((this.parent.grid.allowFiltering && this.parent.grid.filterSettings.columns.length) || | ||
@@ -345,3 +339,3 @@ (this.parent.grid.searchSettings.key.length > 0)) { | ||
qry.queries = fltrQuery.concat(srchQuery); | ||
var filteredData = new DataManager(this.parent.flatData).executeLocal(qry); | ||
var filteredData = new DataManager(results).executeLocal(qry); | ||
this.parent.notify('updateFilterRecs', { data: filteredData }); | ||
@@ -397,3 +391,3 @@ results = this.dataResults.result; | ||
modifiedData: modifiedData, | ||
parentRecords: null, parentIndex: null, filteredResult: results | ||
parentRecords: null, filteredResult: results | ||
}); | ||
@@ -400,0 +394,0 @@ } |
@@ -29,6 +29,2 @@ import { Column } from '../models/column'; | ||
/** | ||
* Specifies the index of parent record | ||
*/ | ||
parentIndex?: number; | ||
/** | ||
* Specifies the index of current record | ||
@@ -38,14 +34,2 @@ */ | ||
/** | ||
* Specifies the filtered index of current record | ||
*/ | ||
filterIndex?: number; | ||
/** | ||
* Specifies the filtered root index of current record | ||
*/ | ||
filterRootIndex?: number; | ||
/** | ||
* Specifies the root index of current record | ||
*/ | ||
rootIndex?: number; | ||
/** | ||
* Specifies the hierarchy level of record | ||
@@ -59,6 +43,2 @@ */ | ||
/** | ||
* Specifies the parentID | ||
*/ | ||
parentIdMapping?: number; | ||
/** | ||
* Specifies the unique ID of a record | ||
@@ -65,0 +45,0 @@ */ |
@@ -26,6 +26,6 @@ import { getObject } from '@syncfusion/ej2-grids'; | ||
var index; | ||
if (!isNullOrUndefined(data.parentIndex) && | ||
if (!isNullOrUndefined(data.parentItem) && | ||
(!(this.parent.allowPaging && !(this.parent.pageSettings.pageSizeMode === 'Root')) || | ||
(isRemoteData(this.parent) && !isOffline(this.parent)))) { | ||
index = data.parentIndex; | ||
index = data.parentItem.index; | ||
var collapsed = (this.parent.initialRender && (!(isNullOrUndefined(parentData[this.parent.expandStateMapping]) || | ||
@@ -99,3 +99,3 @@ parentData[this.parent.expandStateMapping]) || this.parent.enableCollapseAll)) || | ||
var collapsed = true; | ||
if (!isNullOrUndefined(data.parentIndex) && (!isNullOrUndefined(data[this.parent.expandStateMapping]) | ||
if (!isNullOrUndefined(data.parentItem) && (!isNullOrUndefined(data[this.parent.expandStateMapping]) | ||
&& data[this.parent.expandStateMapping]) | ||
@@ -102,0 +102,0 @@ && !(this.parent.allowPaging && !(this.parent.pageSettings.pageSizeMode === 'Root'))) { |
@@ -111,5 +111,4 @@ import { getObject } from '@syncfusion/ej2-grids'; | ||
delete value.parentItem; | ||
delete value.parentIndex; | ||
delete value.level; | ||
return value; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2447276
22532