File tree Expand file tree Collapse file tree 5 files changed +33
-7
lines changed
projects/igniteui-angular/src/lib/grids
src/app/grid-column-pinning Expand file tree Collapse file tree 5 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -1003,8 +1003,8 @@ export class IgxColumnComponent implements AfterContentInit {
10031003 }
10041004
10051005 get rightPinnedOffset ( ) : string {
1006- return this . pinned ?
1007- - this . grid . pinnedWidth + 'px' :
1006+ return this . pinned && ! this . grid . isPinningToStart ?
1007+ - this . grid . pinnedWidth - this . grid . headerFeaturesWidth + 'px' :
10081008 null ;
10091009 }
10101010
Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
180180 private overlayIDs = [ ] ;
181181 private _filteringStrategy : IFilteringStrategy ;
182182 private _sortingStrategy : IGridSortingStrategy ;
183+ private _pinning : IPinningConfig = { columns : ColumnPinningPosition . Start } ;
183184
184185 private _hostWidth ;
185186 private _advancedFilteringOverlayId : string ;
@@ -813,7 +814,16 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
813814 * ```
814815 */
815816 @Input ( )
816- public pinning : IPinningConfig = { columns : ColumnPinningPosition . Start } ;
817+ get pinning ( ) {
818+ return this . _pinning ;
819+ }
820+ set pinning ( value ) {
821+ if ( value !== this . _pinning ) {
822+ this . resetCaches ( ) ;
823+ }
824+ this . _pinning = value ;
825+ }
826+
817827
818828 /**
819829 * Gets/Sets if the built-in column pinning UI should be shown in the toolbar.
@@ -4659,7 +4669,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
46594669 sum += parseInt ( col . calcWidth , 10 ) ;
46604670 }
46614671 }
4662- sum += this . featureColumnsWidth ( ) ;
4672+ if ( this . pinning . columns === ColumnPinningPosition . Start ) {
4673+ sum += this . featureColumnsWidth ( ) ;
4674+ }
46634675
46644676 return sum ;
46654677 }
@@ -4676,6 +4688,10 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
46764688 if ( this . hasVerticalSroll ( ) && ! this . isPercentWidth ) {
46774689 width -= this . scrollWidth ;
46784690 }
4691+ if ( this . pinning . columns === ColumnPinningPosition . End ) {
4692+ width -= this . featureColumnsWidth ( ) ;
4693+ }
4694+
46794695 return width - this . getPinnedWidth ( takeHidden ) ;
46804696 }
46814697
Original file line number Diff line number Diff line change 188188</ div >
189189
190190< div class ="igx-grid__scroll " [style.height] ="'18px' " #scr [hidden] ="isHorizontalScrollHidden ">
191- < div class ="igx-grid__scroll-start " [style.width.px] ='pinnedWidth ' [style.min-width.px] ='isPinningToStart ? pinnedWidth : headerFeaturesWidth '> </ div >
191+ < div class ="igx-grid__scroll-start " [style.width.px] ='isPinningToStart ? pinnedWidth : headerFeaturesWidth ' [style.min-width.px] ='isPinningToStart ? pinnedWidth : headerFeaturesWidth '> </ div >
192192 < div class ="igx-grid__scroll-main " [style.width.px] ='unpinnedWidth '>
193193 < ng-template igxGridFor [igxGridForOf] ='[] ' #scrollContainer >
194194 </ ng-template >
Original file line number Diff line number Diff line change 44 </ app-page-header >
55 < div class ="sample-content ">
66 < div class ="sample-column ">
7- < igx-grid [pinning] ="pinningConfig " #grid1 [data] ="data " [width] ="'800px' " [height] ="'800px' " [rowSelectable] ="true ">
7+ < igx-grid [pinning] ="pinningConfig " #grid1 [data] ="data " [width] ="'800px' " [height] ="'800px' " [rowSelectable] ="false ">
88 < igx-column *ngFor ="let c of columns " [sortable] ="true " [field] ="c.field " [header] ="c.field " [width] ="c.width " [pinned] ='c.pinned '
99 [hidden] ='c.hidden '>
1010 </ igx-column >
2323 < div class ="sample-switches ">
2424 < igx-switch [(ngModel)] ="grid1.showToolbar "> Toolbar</ igx-switch >
2525 < igx-switch [(ngModel)] ="grid1.columnPinning " style ="padding-left: 10px "> Column Pinning</ igx-switch >
26+ < igx-switch [(ngModel)] ="grid1.rowSelectable " style ="padding-left: 10px "> Row Selectors</ igx-switch >
27+ < igx-switch (change) ='onChange() ' style ="padding-left: 10px "> Left Pinning toggle</ igx-switch >
28+
2629 </ div >
2730 </ div >
2831 </ div >
Original file line number Diff line number Diff line change @@ -10,12 +10,19 @@ import { IPinningConfig } from 'projects/igniteui-angular/src/lib/grids/common/g
1010} )
1111
1212export class GridColumnPinningSampleComponent implements OnInit {
13-
1413 public pinningConfig : IPinningConfig = { columns : ColumnPinningPosition . End } ;
1514
1615 @ViewChild ( 'grid1' , { static : true } )
1716 grid1 : IgxGridComponent ;
1817
18+ onChange ( ) {
19+ if ( this . pinningConfig . columns === ColumnPinningPosition . End ) {
20+ this . pinningConfig = { columns : ColumnPinningPosition . Start } ;
21+ } else {
22+ this . pinningConfig = { columns : ColumnPinningPosition . End } ;
23+ }
24+ }
25+
1926 data : any [ ] ;
2027 columns : any [ ] ;
2128
You can’t perform that action at this time.
0 commit comments