in Education by
I have been using a Syncfusion grid in my angular (v.6.0.8) project. In one of the pages, users can mark months as completed by checkboxes. It causes to some of the status changes in the model. Hence, I update the model using "splice", after the backend call is completed. In order to reflect the changes on the grid, I have to call this.deliveryItemsGrid.refresh(); but, this cause to lose the position where the user is working on (grid scrolls up to the top). Is there a way that I could use to refresh the grid without changing the scroll bar position? [HTML] <!-- JAN -->
[ts file] private saveStatusRM(row: DeliveryPlanModel, monthId) { if (row && row.rmYears) { let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0]; selectedRmYear.schoolNumber = this.schoolNumber; selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed = !selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0].completed; selectedRmYear.completed = selectedRmYear.completedMonthsList.every(m => m.completed); if (selectedRmYear.completed) row.statusDisplay = "Completed"; else { if (selectedRmYear.completedMonthsList.some(m => m.completed)) row.statusDisplay = "In progress"; else row.statusDisplay = "Planned"; } // Set the color of the spanners (This is only for front-end use) selectedRmYear.completedMonthsList.forEach(x => { let color: string = ""; if (x.completed) { color = "green"; } else { let dueOn: Date = new Date(+selectedRmYear.year, +x.month + 1, 1); let currentDate: Date = new Date(); color = currentDate < dueOn ? "black" : "red"; } x.color = color; }) // Update the record on the Database. this.deliveryPlanService.updateStatusRM(selectedRmYear).subscribe( data => { if (data) { // Replace the updated record in 'gridRows' var selectedRow = this.gridRows.filter(x => x.rmDetailId == row.rmDetailId)[0] var selectedRecordIndex = this.gridRows.indexOf(selectedRow); this.gridRows.splice(selectedRecordIndex, 1, row); this.calculateRmProgress(this.gridRows); //this.deliveryItemsGrid.refresh(); } }); } } private getMonthCompletionStatus(row: DeliveryPlanModel, monthId): boolean { if (row && row.rmYears) { let selectedRmYear: IYearModel = row.rmYears.filter(y => y.year == this.selectedYear.toString())[0]; if (selectedRmYear && selectedRmYear.completedMonthsList) { var month = selectedRmYear.completedMonthsList.filter(m => m.month == monthId)[0]; return month ? month.completed : null; } else { return null; } } } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
We have analyzed your query and we suggest to get the scrollTop value before the refresh method invoke and bind it to the grid scroll bar after the refresh operation completed using actionComplete event. Please refer to the below sample and documentation for your reference, complete(args){ if(args.requestType == 'refresh' && this.scrollVal){ this.grid.getContent().firstElementChild.scrollTop = this.scrollVal; this.scrollVal = 0; } } refresh(){ this.scrollVal = this.grid.getContent().firstElementChild.scrollTop; this.grid.refresh(); } Sample: https://stackblitz.com/edit/angular-gg4hgd-hrxcwr?file=default.component.ts Documentation: https://ej2.syncfusion.com/documentation/api/grid/#actioncomplete Please get back to us for further assistance. Regards, Thavasianand S.

Related questions

0 votes
    I have used angular-cli with systemJS and am now comfortable with its build process,test cases & component ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I want to display an icon when displaying a message from the service message service which uses MatSnackBar. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    [Kindly let me know how can I improve this question for your better understanding if I am not clear ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    All, I am trying to use syncfusion data grid in xamarin forms now.I have installed trial version as ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    io 3. When you switch on the computer, the Windows OS gets loaded onto the computer's memory, this process is ... (d) None of these Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    I have a basic form with controls that are databound to an object implementing the INotifyPropertyChanged interface. ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    Is "Select column from updated" available in "After Update" trigger? If not what other approach can be ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    Is "Select column from updated" available in "After Update" trigger? If not what other approach can be ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    My json-store contains one record. This record is dirty after changing a field and correctly after store. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    After reading the chapter, I know these points: I know that data gets highlighted after being selected. I know ... entry and editing. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    If the retention policy is set to two days, then for the two days after a record is published, it is available for ... will be discarded to free up space. (1)True (2)False...
asked Jun 17, 2021 in Technology by JackTerrance
0 votes
    I have a 9-cell grid containing images (using bootstrap columns). The grid works fine and is responsive ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a grid it has to display some 100 rows from a table. I do not want to set any paging ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I want to add multiple columns in UITableView. I have created one CustomeTableCell with two lines used - ( ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I want to add multiple columns in UITableView. I have created one CustomeTableCell with two lines used - ( ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
...