Default processed data to prevent count calling length on null

This commit is contained in:
Zakary Timson 2018-06-27 13:54:48 -04:00
parent 5f5abe7fc2
commit dc6ee49467
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/ng-datatable", "name": "@ztimson/ng-datatable",
"version": "1.6.4", "version": "1.6.5",
"homepage": "https://github.com/ztimson/ng-datatable", "homepage": "https://github.com/ztimson/ng-datatable",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": { "author": {

View File

@ -36,7 +36,7 @@ export class NgDatatableComponent implements OnInit {
width = window.innerWidth; // Width of the screen. Used for hiding mobile columns width = window.innerWidth; // Width of the screen. Used for hiding mobile columns
// Fields ============================================================================================================ // Fields ============================================================================================================
get count(): number { return this.processedData.length; } // Number of rows after filtering get count(): number { return this.processedData ? this.processedData.length : 0; } // Number of rows after filtering
private _data: any[] = []; // Original data entered into table private _data: any[] = []; // Original data entered into table
get data(): any[] { return this.processedData; } // Return the processed data get data(): any[] { return this.processedData; } // Return the processed data
@Input() set data(data: any[]) { @Input() set data(data: any[]) {