File tree 8 files changed +37
-20
lines changed
projects/igniteui-angular/src/lib/grids
8 files changed +37
-20
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ export interface RowType {
5
5
checkboxElement : IgxCheckboxComponent ;
6
6
rowID : any ;
7
7
rowData : any ;
8
+ disabled : boolean ;
8
9
rowSelectable : boolean ;
9
10
index : number ;
10
11
gridID : string ;
11
12
added : boolean ;
13
+ pinned : boolean ;
12
14
deleted : boolean ;
13
15
selected : boolean ;
14
16
focused : boolean ;
Original file line number Diff line number Diff line change @@ -5784,7 +5784,8 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
5784
5784
this . lastSearchInfo = { ...this . lastSearchInfo } ;
5785
5785
5786
5786
if ( scroll !== false ) {
5787
- this . scrollTo ( matchInfo . row , matchInfo . column ) ;
5787
+ matchInfo . row . ghostRec !== undefined ? this . scrollTo ( matchInfo . row . recordData , matchInfo . column ) :
5788
+ this . scrollTo ( matchInfo . row , matchInfo . column ) ;
5788
5789
}
5789
5790
5790
5791
IgxTextHighlightDirective . setActiveHighlight ( this . id , {
@@ -5931,7 +5932,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
5931
5932
const datePipe = new IgxDatePipeComponent ( this . locale ) ;
5932
5933
data . forEach ( ( dataRow ) => {
5933
5934
const ghostRec = dataRow . ghostRec !== undefined ;
5934
- const data = { ...dataRow } ;
5935
+ const dataRowRec = { ...dataRow } ;
5935
5936
dataRow = ghostRec ? dataRow . recordData : dataRow ;
5936
5937
columnItems . forEach ( ( c ) => {
5937
5938
const value = c . formatter ? c . formatter ( dataRow [ c . field ] ) :
@@ -5944,7 +5945,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
5944
5945
if ( exactMatch ) {
5945
5946
if ( searchValue === searchText ) {
5946
5947
this . lastSearchInfo . matchInfoCache . push ( {
5947
- row : data ,
5948
+ row : dataRowRec ,
5948
5949
column : c . field ,
5949
5950
index : 0 ,
5950
5951
} ) ;
Original file line number Diff line number Diff line change @@ -58,6 +58,17 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
58
58
@Input ( )
59
59
public index : number ;
60
60
61
+ /**
62
+ * Sets whether this specific row has disabled functionality for editing and row selection.
63
+ * Default value is `false`.
64
+ * ```typescript
65
+ * this.grid.selectedRows[0].pinned = true;
66
+ * ```
67
+ */
68
+ @Input ( )
69
+ @HostBinding ( 'class.igx-grid__tr--disabled' )
70
+ public disabled = false ;
71
+
61
72
/**
62
73
* Gets whether the row is pinned.
63
74
* ```typescript
@@ -309,7 +320,7 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
309
320
*/
310
321
@HostListener ( 'click' , [ '$event' ] )
311
322
public onClick ( event : MouseEvent ) {
312
- if ( this . grid . rowSelection === 'none' || this . deleted ) { return ; }
323
+ if ( this . grid . rowSelection === 'none' || this . deleted || this . disabled ) { return ; }
313
324
if ( event . shiftKey && this . grid . rowSelection === 'multiple' ) {
314
325
this . selectionService . selectMultipleRows ( this . rowID , this . rowData , event ) ;
315
326
return ;
@@ -321,6 +332,7 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
321
332
* @hidden
322
333
*/
323
334
public onRowSelectorClick ( event ) {
335
+ if ( this . disabled ) { return ; }
324
336
event . stopPropagation ( ) ;
325
337
if ( event . shiftKey && this . grid . rowSelection === 'multiple' ) {
326
338
this . selectionService . selectMultipleRows ( this . rowID , this . rowData , event ) ;
Original file line number Diff line number Diff line change 1
1
< ng-template #defaultCell >
2
2
< div igxTextHighlight style ="pointer-events: none " [cssClass] ="highlightClass " [activeCssClass] ="activeHighlightClass " [groupName] ="gridID "
3
3
[value] ="formatter ? formatter(value) : column.dataType === 'number' ? (value | igxdecimal: grid.locale) : column.dataType === 'date' ? (value | igxdate: grid.locale) : value "
4
- [row] ="row.treeRow.data " [column] ="this.column.field " [containerClass] ="'igx-grid__td-text' "
4
+ [row] ="rowData " [column] ="this.column.field " [containerClass] ="'igx-grid__td-text' "
5
5
class ="igx-grid__td-text "> {{ formatter ? formatter(value) : column.dataType === 'number' ? (value | igxdecimal:
6
6
grid.locale) : column.dataType === 'date' ? (value | igxdate: grid.locale) : value }}</ div >
7
7
</ ng-template >
36
36
(click) ="toggle($event) " (focus) ="onIndicatorFocus() " tabindex ="-1 ">
37
37
< ng-container *ngTemplateOutlet ="iconTemplate; context: { $implicit: this } ">
38
38
</ ng-container >
39
- <!-- <igx-chip [hidden]="!row.pinnedBodyInstance"
40
- draggable="false"
41
- disabled="true"
42
- displayDensity="cosy"
43
- #pinnedIndicator>
44
- Pinned
45
- </igx-chip> -->
39
+ < igx-chip *ngIf ="displayPinnedChip " class ="igx-grid__td--pinned-chip " [disabled] ="true " [displayDensity] ="'compact' "> Pinned</ igx-chip >
46
40
</ div >
47
41
< div *ngIf ="isLoading "
48
42
(dblclick) ="onLoadingDblClick($event) "
Original file line number Diff line number Diff line change @@ -70,4 +70,11 @@ export class IgxTreeGridCellComponent extends IgxGridExpandableCellComponent {
70
70
public onLoadingDblClick ( event : Event ) {
71
71
event . stopPropagation ( ) ;
72
72
}
73
+
74
+ /**
75
+ * @hidden
76
+ */
77
+ public get displayPinnedChip ( ) {
78
+ return this . row . pinned && this . row . disabled && this . visibleColumnIndex === 0 && ! ( this . column as any ) . cellTemplate ;
79
+ }
73
80
}
Original file line number Diff line number Diff line change 21
21
[class.igx-grid__td--number] ="col.dataType === 'number' "
22
22
[ngClass] ="col.cellClasses | igxCellStyleClasses:rowData[col.field]:rowData:col.field:viewIndex "
23
23
[ngStyle] ="col.cellStyles | igxCellStyles:rowData[col.field]:rowData:col.field:viewIndex "
24
- [editMode] ="col.editable && crudService.isInEditMode(index, col.index) "
24
+ [editMode] ="col.editable && crudService.isInEditMode(index, col.index) && !disabled "
25
25
[column] ="col "
26
26
[formatter] ="col.formatter "
27
27
[row] ="this "
47
47
[level] ="treeRow.level "
48
48
[expanded] ="treeRow.expanded "
49
49
[showIndicator] ="showIndicator "
50
- [editMode] ="col.editable && crudService.isInEditMode(index, col.index) "
50
+ [editMode] ="col.editable && crudService.isInEditMode(index, col.index) && !disabled "
51
51
[column] ="col "
52
52
[formatter] ="col.formatter "
53
53
[row] ="this "
75
75
< igx-checkbox
76
76
[readonly] ="true "
77
77
[checked] ="selected "
78
- [disabled] ="deleted "
78
+ [disabled] ="deleted || disabled "
79
79
disableRipple ="true "
80
80
[disableTransitions] ="grid.disableTransitions "
81
81
[aria-label] ="rowCheckboxAriaLabel ">
Original file line number Diff line number Diff line change 115
115
</ ng-template >
116
116
</ ng-template >
117
117
< ng-container *ngTemplateOutlet ="hasPinnedRecords && !isRowPinningToTop ? pinnedRecordsTemplate : null "> </ ng-container >
118
- < ng-template #record_template let-rowIndex ="index " let-rowData >
119
- < igx-tree-grid-row [gridID] ="id " [index] ="rowIndex " [treeRow] ="rowData " #row >
118
+ < ng-template #record_template let-rowIndex ="index " let-disabledRow =" disabled " let- rowData>
119
+ < igx-tree-grid-row [gridID] ="id " [index] ="rowIndex " [treeRow] ="rowData " [disabled] =" disabledRow " #row >
120
120
</ igx-tree-grid-row >
121
121
</ ng-template >
122
122
< ng-template #summary_template let-rowIndex ="index " let-rowData >
Original file line number Diff line number Diff line change @@ -378,10 +378,10 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
378
378
/**
379
379
* @hidden @internal
380
380
*/
381
- private flattenTreeGridRecords ( records : ITreeGridRecord [ ] , flatData : any [ ] ) {
381
+ private flattenTreeGridRecords ( records : any [ ] , flatData : any [ ] ) {
382
382
if ( records && records . length ) {
383
383
for ( const record of records ) {
384
- ( this . isGhostRecord ( record ) ) ? flatData . push ( record . data . recordData ) : flatData . push ( record . data ) ;
384
+ ( this . isGhostRecord ( record ) ) ? flatData . push ( record . recordData ) : flatData . push ( record ) ;
385
385
this . flattenTreeGridRecords ( record . children , flatData ) ;
386
386
}
387
387
}
@@ -638,7 +638,8 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
638
638
return {
639
639
$implicit : rowData ,
640
640
index : rowIndex ,
641
- templateID : this . isSummaryRow ( rowData ) ? 'summaryRow' : 'dataRow'
641
+ templateID : this . isSummaryRow ( rowData ) ? 'summaryRow' : 'dataRow' ,
642
+ disabled : this . isGhostRecord ( rowData . data )
642
643
} ;
643
644
}
644
645
You can’t perform that action at this time.
0 commit comments