i try to use jQuery Bootgrid together with Angular 2. The Problem is that that Bootgrid inspects an existing Table, but with angular2 my data is based on an asyncrone source.
I try to initialize the grid later when the data is set in the controller with no luck. I think that the grid have to be initialized AFTER the DOM was updated by angular2. Is there such a "after component-dom update"-Event? Or any other ideas?
Here my Code:
records: Record[] = []
grid: any
ngOnInit() {
this._recordService.getAllRecords().subscribe(
data=> { this.records = data },
error=> { alert(error) }
)
.add(() => setTimeout(() => this.initGrid(), 50));
}
initGrid() {
this.grid = jQuery("#grid-basic");
var ref = this;
this.grid.bootgrid({
...config Stuff...
})
}
That will work only because of the ugly "setTimeout". Without the timeout the table will display "no data" (my bootgrid info label of the record count is updated with correctly)
Thanks for any ideas!