Posted 28 August 2019, 7:11 am EST - Updated 3 October 2022, 7:28 pm EST
Hi,
We have Angular 7 wizard application in which user can able to bind the data from excel sheet into wijmo flex grid. I can able to successfully import the data, bind it inside the model and then save it into the database when user clicks on NEXT button. The problem is when user comes back to previous page it binds data twice with the selected value property and not the display property. Can you please let me know how to bind the data again into grid ?
Below is the code for import functionality(the code is large so I put the main approach here) :
bindImportedDataIntoModel() {
const newData = _.cloneDeep(getImportedCVData(this.flex));
let columns = JSON.parse(this.flex.columnLayout).columns;
this.data = new wjcCore.CollectionView(newData);
this.flex.autoGenerateColumns = true;
this.flex.itemsSource = this.data;
this.flex.collectionView.refresh();
const newCol = JSON.parse(this.flex.columnLayout).columns;
newCol.splice(0, columns.length);
columns = { columns: newCol };
this.flex.columnLayout = JSON.stringify(columns);
this.bindPolicyLimtitID();
this.bindCoverageID();
this.deepGridCopy();
this.trackGridDataChanges();
}
Below is the code to bind data into grid:
ngOnInit() {
this.publishDataService.currentData$.subscribe(data => {
if (data && data.gridType && data.gridType === GridType.POLICY_DETAILS_GRID) {
const gridData: wjcCore.CollectionView = _.cloneDeep(data.gridData);
this.data = new wjcCore.CollectionView(gridData);
if (data.coverages) {
this.coverages = new wjcGrid.DataMap(data.coverages, 'coverageID', 'coverage');
}
if (data.limitNames) {
this.limitNames = new wjcGrid.DataMap(data.limitNames, 'limitNameID', 'limitName');
}
this.trackGridDataChanges();
this.deepGridCopy();
}
});
this.showToolTip();
}