[view/timeline,bugfix][xs]: timeline crashes if no entries so create placeholder entry for timeline if no entries from data.

This commit is contained in:
Rufus Pollock 2012-06-03 22:08:22 +01:00
parent 530ebc44a2
commit 915f00e21a

View File

@ -92,6 +92,14 @@ my.Timeline = Backbone.View.extend({
out.timeline.date.push(tlEntry);
}
});
// if no entries create a placeholder entry to prevent Timeline crashing with error
if (out.timeline.date.length === 0) {
var tlEntry = {
"startDate": '2000,1,1',
"headline": 'No data to show!'
};
out.timeline.date.push(tlEntry);
}
return out;
},