Skip to content

Commit cf316eb

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix overwrite position. Update generic pinned collection.
1 parent 04b444d commit cf316eb

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,11 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
22562256
this.grid.crudService.endEdit(false);
22572257

22582258
this._pinned = true;
2259-
this._pinningPosition = pinningPosition;
2259+
if (pinningPosition !== null && pinningPosition !== undefined) {
2260+
// if user has set some position in the params, overwrite the column's position.
2261+
this._pinningPosition = pinningPosition;
2262+
}
2263+
22602264
this.pinnedChange.emit(this._pinned);
22612265
// it is possible that index is the last position, so will need to find target column by [index-1]
22622266
const targetColumn = args.insertAtIndex === pinningCollection.length ?
@@ -2265,6 +2269,7 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
22652269
if (pinningCollection.indexOf(this) === -1) {
22662270
if (!grid.hasColumnGroups) {
22672271
pinningCollection.splice(args.insertAtIndex, 0, this);
2272+
grid._pinnedColumns = this.grid.pinnedStartColumns.concat(this.grid.pinnedEndColumns);
22682273
} else {
22692274
// insert based only on root collection
22702275
if (this.level === 0) {

src/app/grid-column-moving/grid-column-moving.sample.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h4>Sample 1</h4>
3333
<igx-column [field]="c.field" [header]="c.field" [groupable]="c.groupable"
3434
[resizable]="c.resizable" width="auto" [sortable]="c.sortable" [filterable]="c.filterable"
3535
[editable]="true" [hidden]="c.hidden" [hasSummary]="c.summary" [minWidth]="'150px'" [maxWidth]="'400px'"
36-
[dataType]="c.type" [pinned]='c.pinned' [hidden]='c.hidden'>
36+
[dataType]="c.type" [pinned]='c.pinned' [hidden]='c.hidden' [pinningPosition]="c.pinningPosition">
3737
<ng-template igxCell let-cell="cell">
3838
@if (show) {
3939
<div>{{ cell.value}}</div>

src/app/grid-column-moving/grid-column-moving.sample.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FormsModule } from '@angular/forms';
33

44
import { SAMPLE_DATA } from '../shared/sample-data';
55

6-
import { IgxButtonDirective, IgxButtonGroupComponent, IgxCellHeaderTemplateDirective, IgxCellTemplateDirective, IgxCollapsibleIndicatorTemplateDirective, IgxColumnComponent, IgxColumnGroupComponent, IgxGridComponent, IgxGridToolbarActionsComponent, IgxGridToolbarAdvancedFilteringComponent, IgxGridToolbarComponent, IgxGridToolbarHidingComponent, IgxGridToolbarPinningComponent, IgxIconComponent, IgxInputDirective, IgxInputGroupComponent, IgxLabelDirective, IgxPaginatorComponent } from 'igniteui-angular';
6+
import { ColumnPinningPosition, IgxButtonDirective, IgxButtonGroupComponent, IgxCellHeaderTemplateDirective, IgxCellTemplateDirective, IgxCollapsibleIndicatorTemplateDirective, IgxColumnComponent, IgxColumnGroupComponent, IgxGridComponent, IgxGridToolbarActionsComponent, IgxGridToolbarAdvancedFilteringComponent, IgxGridToolbarComponent, IgxGridToolbarHidingComponent, IgxGridToolbarPinningComponent, IgxIconComponent, IgxInputDirective, IgxInputGroupComponent, IgxLabelDirective, IgxPaginatorComponent } from 'igniteui-angular';
77

88
@Component({
99
providers: [],
@@ -76,11 +76,11 @@ export class GridColumnMovingSampleComponent implements OnInit {
7676
{ field: 'ID', width: 150, resizable: true, sortable: false, filterable: true, groupable: true,
7777
summary: true, type: 'string', pinned: false, hidden: true },
7878
{ field: 'CompanyName', width: 150, resizable: true, sortable: true, filterable: true, groupable: true,
79-
summary: true, type: 'string'},
79+
summary: true, type: 'string', pinned: true , pinningPosition: ColumnPinningPosition.End},
8080
{ field: 'ContactName', width: 150, resizable: true, sortable: true, filterable: true, groupable: true,
8181
summary: true, type: 'string' },
8282
{ field: 'ContactTitle', width: 150, resizable: true, sortable: true, filterable: true, groupable: true,
83-
summary: true, type: 'string' },
83+
summary: true, type: 'string', pinningPosition: ColumnPinningPosition.End },
8484
{ field: 'Address', width: 150, resizable: true, sortable: true, filterable: true, groupable: true,
8585
summary: true, type: 'string' },
8686
{ field: 'City', width: 150, resizable: true, sortable: false, filterable: false, groupable: true,

0 commit comments

Comments
 (0)