Posted 19 August 2019, 3:08 pm EST
Hi Oskar,
The reason that the row becomes visible and the columns go back to their default after the data is loaded asynchronously is that when the source is changed, the rows and the columns are recreated.
To solve this, assign an empty CollectionView as the source of the Sheet and handle its sourceCollectionChanged event. In this event handler, hide the header row and auto-size the columns.
When your source is loaded asynchronously, then assign this as the sourceCollection of the CollectionView instance. Please refer to the code snippet below and the sample for reference:
var self = this;
self.source = new wjcCore.CollectionView([], {
sourceCollectionChanged: function (s, e) {
if (self.formatSheet) {
self.formatSheet.rows[0].visible = false;
self.formatSheet.autoSizeColumns(0, 2);
}
}
});
wjcCore.httpRequest('https://api.myjson.com/bins/1130if', {
method: 'GET',
success: function (xhr) {
self.source.sourceCollection = (JSON.parse(xhr.responseText));
}
})
https://stackblitz.com/edit/angular-i1z2j6
Regards,
Ashwin