Skip to content

Commit

Permalink
Merge pull request #425 from IgniteUI/IGanchev/fix-grid-summaries-tem…
Browse files Browse the repository at this point in the history
…plate

Fix CustomDateSummary result
  • Loading branch information
bazal4o authored Dec 13, 2018
2 parents 2d10102 + 988582e commit cb1e3c1
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import { employeesData } from './localData';

@Component({
encapsulation: ViewEncapsulation.None,
selector: 'app-grid-summaries',
templateUrl: './grid-summaries.component.html',
styleUrls: ['./grid-summaries.component.scss']
selector: 'app-$(filePrefix)',
templateUrl: './$(filePrefix).component.html',
styleUrls: ['./$(filePrefix).component.scss']
})
export class GridSummariesComponent implements OnInit {


export class $(ClassName)Component implements OnInit {
@ViewChild('sampleGrid', { read: IgxGridComponent })
public sampleGrid: IgxGridComponent;
customDateSummary = CustomDateSummary;
public customDateSummary = CustomDateSummary;

public localData: any[];
title = 'Grid Summaries';
Expand All @@ -32,7 +34,7 @@ export class GridSummariesComponent implements OnInit {
if (this.sampleGrid.getColumnByName(name).hasSummary) {
this.sampleGrid.disableSummaries(name);
} else {
this.sampleGrid.enableSummaries(name, this.customDateSummary);
this.sampleGrid.enableSummaries(name);
}
}
}
Expand All @@ -47,12 +49,12 @@ class CustomDateSummary extends IgxDateSummaryOperand {
result.push({
key: 'earliest',
label: 'Earliest Date',
summaryResult: (IgxDateSummaryOperand.earliest(data)).toLocaleDateString()
summaryResult: data.length ? (IgxDateSummaryOperand.earliest(data)).toLocaleDateString() : null
});
result.push({
key: 'latest',
label: 'Latest Date',
summaryResult: (IgxDateSummaryOperand.latest(data)).toLocaleDateString()
summaryResult: data.length ? (IgxDateSummaryOperand.latest(data)).toLocaleDateString() : null
});

return result;
Expand Down

0 comments on commit cb1e3c1

Please sign in to comment.