IgniteUI / igniteui-angular

Ignite UI for Angular is a complete library of Angular-native, Material-based Angular UI components with the fastest grids and charts, Pivot Grid, Dock Manager, Hierarchical Grid, and more.
https://www.infragistics.com/products/ignite-ui-angular
Other
571 stars 163 forks source link

grid rowSelectionChanging behavior has changed 15.1.x #12990

Closed ricardosaracino closed 1 year ago

ricardosaracino commented 1 year ago

Description

I updated from from 15.0.x to 15.1.x and rowSelectionChanging is passing the row instead of the primaryKey

The below code on 15.0 is getting an array of numbers but on 15.1 its getting an array or rows. I am rolling back my upgrade as this breaks a ton of code and its not in the upgrade guide.

https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/update-guide#from-150x-to-151x

 <igx-grid #complianceTemplatesListGrid (rowSelectionChanging)="handleRowSelection($event)"
            (sortingDone)="removeSorting($event)" [allowFiltering]="true" [autoGenerate]="false"
            [cellSelection]="'none'" [clipboardOptions]="clipboardOptions" [data]="complianceTemplatesList$ | async"
            [hideRowSelectors]="false" [moving]="true" [primaryKey]="'id'" [rowSelection]="'multiple'" height="100%">
    <igx-column [dataType]="'string'" [header]="'LABELS.NAME' | translate" [resizable]="true"
                [sortable]="true" field="name">
    </igx-column>
  </igx-grid>
  public handleRowSelection(e: IRowSelectionEventArgs): void {
    this.selectedRows = e.newSelection;
    this.complianceListForm.markAsDirty();
  }
 "dependencies": {
    "@angular/animations": "^15.2.8",
    "@angular/cdk": "^15.2.8",
    "@angular/common": "^15.2.8",
    "@angular/compiler": "^15.2.8",
    "@angular/core": "^15.2.8",
    "@angular/forms": "^15.2.8",
    "@angular/material": "^15.2.8",
    "@angular/platform-browser": "^15.2.8",
    "@angular/platform-browser-dynamic": "^15.2.8",
    "@angular/router": "^15.2.8",
    "@fontsource/titillium-web": "^4.5.9",
    "@fortawesome/fontawesome-free": "^6.4.0",
    "@infragistics/igniteui-angular": "15.1.5",
    "@ngrx/effects": "^15.4.0",
    "@ngrx/router-store": "^15.4.0",
    "@ngrx/store": "15.4.0",
    "@ngrx/store-devtools": "^15.4.0",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "@sentry/angular": "^7.50.0",
    "@sentry/tracing": "^7.50.0",
    "accounting": "^0.4.1",
    "bootstrap": "^5.2.3",
    "date-fns": "^2.30.0",
    "file-saver": "^2.0.5",
    "igniteui-angular-charts": "^15.0.1",
    "igniteui-angular-core": "^15.0.1",
    "igniteui-theming": "^1.4.2",
    "jszip": "^3.10.1",
    "material-icons": "^1.13.6",
    "ngx-permissions": "^15.0.1",
    "rxjs": "~7.8.1",
    "zone.js": "~0.13.0"
  },
hanastasov commented 1 year ago

Hi @ricardosaracino

thank you for reaching out to us reporting this. I apologize about this upgrade experience. I logged an issue about adding information regarding this change in the Update guide - https://github.com/IgniteUI/igniteui-docfx/issues/3634, so hopefully this will prevent other people from having trouble with the update.

Information about the changes is existing in the feature help topic and in the Changelog:

Wherever in your app the oldSelection, newSelection, added and removed props are read from IRowSelectionEventArgs object in the rowSelectionChanging event, map the row objects collection into a primaryKeys collection:

  public handleRowSelection(e: IRowSelectionEventArgs): void {
    this.selectedRows = e.newSelection.map(rec => {
       return rec[e.owner?.primaryKey]
    });
    this.complianceListForm.markAsDirty();
  }
hanastasov commented 1 year ago

Update guide now includes information about changes in the rowSelectionChanging event.

https://www.infragistics.com/products/ignite-ui-angular/angular/components/general/update-guide#from-150x-to-151x