Hi team,
we are using datamanger to bind the data to grid, we are updating gridview row after updating the serverside. we are using setRowData to update the grid row but it is not updating grid row for the records which are loaded in first iteration. but it is updating the grid row for the records which are loaded on second iteration (loaded records on scrolling) we set [enableInfiniteScrolling]='true'
we are using syncfusion/ej2-angular-grids @20.1.55
Thanks ,
Dayakar.
Hi Dayakar Reddy,
Thanks for contacting Syncfusion support.
We have tried to reproduce the issue ”SetRowData is not updating the Grid rows properly” but it is working fine at our end. We have prepared a simple sample based on the given code which is attached below.
Also, for using the “setRowData” method we need to assign a primary key column that should have unique values. Please refer to the below documentation for this requirement.
https://ej2.syncfusion.com/documentation/api/grid/#setrowdata
To validate further, please share the below details that will be helpful for us to provide a better solution as early as possible.
Regards,
Pavithra S
Hi,
Please find the below link to reporduce the issue
Thank you.
Hi Dayakar Reddy,
Thanks for sharing the details.
Query#1: the setRowData() do not work when any of column is frozen;
The reported issue is already a known issue and has been fixed in our 20.2.46 release and working fine with the latest version 20.2.49. So, we suggest to upgrade the Syncfusion package to overcome the issue.
Please refer to the below documentation for package updating to 20.2.49 version.
https://ej2.syncfusion.com/angular/documentation/common/how-to/update-npm-package/
https://ej2.syncfusion.com/angular/documentation/release-notes/20.2.46/?type=all#grid
Query#2: when allow grouping is on and when we try to freeze any column remove allow grouping
In our EJ2 Grid, the frozen columns are not compatible with the Grid grouping feature. Please refer to the below documentation for Frozen column limitations.
https://ej2.syncfusion.com/angular/documentation/grid/frozen/#limitations-of-frozen-grid
Regards,
Pavithra S
HI, i updated to latest version, the issue still exists, please try in the below link
step 1) click on load 100 k data
2) freeze column using column menu
3) click on setrowdata for row 2
Hi Dayakar Reddy,
Since the given sample is not running at our end, we have prepared a new sample with the same code and the latest package version which is working fine. Please refer to the below screenshot and sample link for more information.
|
|
https://stackblitz.com/edit/angular-61gjtf?file=app.component.html,app.component.ts,data.ts
Please get back to us if you still facing the issue in the above sample.
Regards,
Pavithra S
Hi Pavitra,
In the screenshot you have not frozen any of the column, can you freeze any of the column and update the row.
please follow the below steps. I attached screenshot for your reference
1) click load 100k data
2) select 3 dots for SNO column and click freeze column
3) click on SetRowData for row2, it will not update the row, because the column is freezeed.
Hi Dayakar Reddy,
We have confirmed this as an issue and logged the defect report “SetRowData is not working when adding the frozen columns dynamically” for the same. Thank you for taking time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and this fix will be included in our upcoming patch release which is expected to be rolled out on or before 12th October 2022.
You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
https://www.syncfusion.com/feedback/37923/setrowdata-is-not-working-when-adding-the-frozen-columns-dynamically
Disclaimer: “Inclusion of this solution in the weekly release may change
due to other factors including but not limited to QA checks and works
reprioritization”
Until then we appreciate your patience.
Regards,
Pavithra S
Hi Dayakar,
Thanks for your patience
By default, for the Grid, the dataSource or columns any of these properties must be defined to function properly in initial rendering, it is a constraint of grid. Please refer the below modified sample to resolve the problem.
|
export class AppComponent { public vData: Object[] = []; @ViewChild('grid') public grid: GridComponent; public pageSettings: object = { pageSize: 50 }; public infiniteOptions: InfiniteScrollSettingsModel = { initialBlocks: 1 }; editSettings = { allowEditing: false, allowAdding: true, allowDeleting: true, mode: 'Normal', }; isInitialLoad = true; gridName = 'grid12345'; columns = []; columnMenuItems: any = [ 'Filter', { text: 'Freeze column', id: 'freezecolumn' }, { text: 'UnFreeze column', id: 'unfreezecolumn' }, ]; public ngOnInit(): void { this.renderColumns(); }
onClick = (args: any) => {
getDatasource(); this.grid.dataSource = this.vData = infiniteData; this.grid.refresh(); }; onClick2 = (args: any) => { this.grid.setRowData(2, { SNO: 2, FIELD1: 'Updated' }); }; onClick3 = (args: any) => { this.grid.setRowData(52, { SNO: 52, FIELD1: 'Updated' }); };
renderColumns() { console.log('renderColumns'); this.columns = []; const columnData = [ { field: 'SNO', visible: true, isPrimaryKey: true,
type: 'string', clipMode: 'EllipsisWithTooltip', }, { field: 'FIELD1', headerText: 'Player Name', allowEditing: true, allowFiltering: true,
type: 'string', clipMode: 'EllipsisWithTooltip', }, { field: 'FIELD2', headerText: 'Year', allowEditing: false, allowFiltering: true,
type: 'string', clipMode: 'EllipsisWithTooltip', }, { field: 'FIELD3', headerText: 'Stint', allowEditing: false, allowFiltering: true, type: 'string', clipMode: 'EllipsisWithTooltip', }, ]; columnData.forEach((item) => { const column = Object.assign({}, item); this.columns.push(column); }); }
columnMenuClick(args) { if (args.item.id === 'freezecolumn') { this.grid.getColumnByField(args.column.field).isFrozen = true; this.grid.allowGrouping = !this.grid.isFrozenGrid(); this.grid.freezeRefresh(); } else if (args.item.id === 'unfreezecolumn') { this.grid.getColumnByField(args.column.field).isFrozen = false; this.grid.allowGrouping = !this.grid.isFrozenGrid(); this.grid.freezeRefresh(); }
} }
|
Sample : https://stackblitz.com/edit/angular-61gjtf-daotuh?file=app.component.html,app.component.ts,data.ts
Note: When freeze the any column, allowGrouping property can be changed before refresh the grid component
Regards,
Rajapandi R