fix(virtual-scroll): supports null records

fixes 11093
This commit is contained in:
Manuel Mtz-Almeida
2017-04-24 23:48:23 +02:00
parent 78d427dfcf
commit 67af71bd9b
2 changed files with 4 additions and 4 deletions

View File

@ -892,7 +892,7 @@ export function enableTouchControl(s: Slides) {
// Cleanup dynamic styles
function cleanupStyles(s: Slides) {
if (!s.container || !s._wrapper) {
//fix #10830
// fix #10830
return;
}

View File

@ -21,7 +21,7 @@ export function processRecords(stopAtHeight: number,
let startRecordIndex: number;
let previousCell: VirtualCell;
let tmpData: any;
let lastRecordIndex = (records.length - 1);
let lastRecordIndex = records ? (records.length - 1) : -1;
if (cells.length) {
// we already have cells
@ -131,11 +131,11 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
cells: VirtualCell[], records: any[], nodes: VirtualNode[], viewContainer: ViewContainerRef,
itmTmp: TemplateRef<VirtualContext>, hdrTmp: TemplateRef<VirtualContext>, ftrTmp: TemplateRef<VirtualContext>,
initialLoad: boolean): boolean {
const recordsLength = records.length;
if (!recordsLength) {
if (!records || records.length === 0) {
nodes.length = 0;
return true;
}
const recordsLength = records.length;
let hasChanges = false;
let node: VirtualNode;