[igx-grid] capability to prevent from moving columns to pinned area.
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
There are two types of columns, pinned columns and unpinned columns.
- The former ones are not movable.
- The latter ones are movable only in the unpinned area.
I created a sample. https://stackblitz.com/edit/igx-grid-prevent-from-moving-to-pinned-area
- "ID" column is pinned.
- The other columns are not pinned and movable.
I wanted the others not to move to pinned area. I tried onColumnPinning and onColumnMovingEnd and found that they are not cancelable. So, currently, there is no way to achieve what I want.
Describe alternatives you've considered
I checked DOM tree and found droppable attribute is attached to the igx-grid-header.
https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grids/grid-header-group.component.html#L24
When I set it to false like below, I was able to achieve that. Unfortunately, droppable attribute is totally undocumented and this implementation is a kind of hack. I don't want to do that as possible.
@ViewChild('grid') grid: IgxGridComponent;
ngAfterViewInit() {
this.grid.headerCellList.filter(headerCell => headerCell.column.pinned)
.forEach(headerCell => {
const elem = headerCell.elementRef.nativeElement as HTMLElement;
elem.setAttribute('droppable', 'false');
});
}
Additional context
N/A
@tkiryu IMO, this should be handled with a pinnable input on the IgxColumnComponent. What do you think?
@ChronosSF @MayaKirova
@kdinev , thanks for your opinion. That's a good idea. I agree with you!
@kdinev @tkiryu There is already an input for the IgxColumnComponent called disablePinning but it seems there is an issue not working as expected when moving a column when it is set to true.
I already have a fix for it and can easily apply it.
Should we also keep the name of the input if you agree to go with this approach? If we change it to pinnable we would have to make a breaking change.
@skrustev Don't rename the input, as it would expect opposite values, so the default also would change. Just keep it, but apply the fix for the specific scenario.