Thanks for the demo, I thought it might have something to do with using a collection view but hadn’t had a chance to delve too much into it yet.
I tried implementing a collectionView and storing in ngrx, however that didn’t seem to work as each time the ngrx collectionView was updated it would send a basically brand new collectionView to the component.
So I funneled the data updates directly into component and used a collectionView there, but I’m still having a problem with my implementation it seems like.
public cvs= {}
handleData(data) {
const item = {
id: data.TTNumber,
TTN: data.TTNumber,
Format: '---',
type: data.geoPosition.type,
symbol: data.symbol,
location: data.geoPosition.coordinates[0] + ', ' + data.geoPosition.coordinates[1]
};
data.matchingFilterIds.map(filter => {
if (this.cvs[filter]){
let existingIndex = -1;
this.cvs[filter].items.map((row,i) => {
if (row.TTN === item.TTN) {
existingIndex = i;
}
});
if (existingIndex > -1) {
this.cvs[filter][existingIndex] = item;
}
else {
this.cvs[filter].items.push(item);
}
this.cvs[filter].refresh();
}
else {
this.vcs[filter] = new wijmo.CollectionView([item]);
}
});
}
The handleData function fires several times a second with updates.
So this is a bit more complex then maybe needed for illustration purposes. Essentially data that comes in is tagged with applicable filters that the item applies to. The data is displayed in a tabular format for each filter, with each tab displaying a table of the data. So a data item may have 0 or more filters. Which means it could appear on 0 or more tables.
So the code iterates through the applicable filters first. Checks whether a CV has been created and stored for that filter, and if not it simply creates it and stores a reference to it. If it already exists it iterates through the items first to see if the record already exists, and if so updates it. If it doesn’t exist it just appends it, then refreshes the CV.
The template looks something like:
<div *ngFor="filter in filters">
<wj-flex-grid [itemSource]="cvs[filter]"/>
</div>
What I’m experiencing is that when the first data item comes in - it loads fine, but subsequent items or updates don’t seem to load.
I have a feeling you’re going to tell me I can’t store a reference to a collectionView like that, and once it’s passed to the grid, it’s only stored internally.