ng2-smart-table
ng2-smart-table copied to clipboard
TypeError: Cannot read property 'createFormShown' of undefined
I have an issue with ng2-smart-table
i have a component
with this parts: station/ smart-table/ smart-table.component.ts smart-table.component.html station.module.ts station.component.ts station.component.html station.component.scss
and when i use ngx-smart-table selector in station.component.html it sends a lot of errors in the console and not shown the table i got this trace back ERROR TypeError: Cannot read property 'createFormShown' of undefined at Object.eval [as updateDirectives] (Ng2SmartTableTheadComponent.html:1) at Object.debugUpdateDirectives [as updateDirectives] (core.js:11922) at checkAndUpdateView (core.js:11315) at callViewAction (core.js:11556) at execComponentViewsAction (core.js:11498) at checkAndUpdateView (core.js:11321) at callViewAction (core.js:11556) at execEmbeddedViewsAction (core.js:11519) at checkAndUpdateView (core.js:11316) at callViewAction (core.js:11556)
what should i do?
I am also facing this issue, What is the solution for this.
Answering an old issue to serve as a reference to people that come here looking for a solution.
I had this problem and figured out that it occurs when there is an error that keeps initGrid method from completing:
initGrid() {
this.source = this.prepareSource();
this.grid = new Grid(this.source, this.prepareSettings());
this.subscribeToOnSelectRow();
this.subscribeToOnDeselectRow();
}
When there's an error in the Grid constructor, the this.grid
reference stays undefined and later comes the Cannot read property 'createFormShown' of undefined
error.
Most of the Grid constructor code is harmless but at some point it calls your DataSource.refresh() method and if this datasource refresh raises an exception everything goes south. The main problem is that the exception will not appear in logs and it is hard to follow the problem. It would be nice if errors in refresh were catched and logged.
In my case I had a class extending the ServerDataSource and overriding addFilterRequestParams method and there was an error in this method.
This bug can be skipped if you get the data before "setting the settings", so the DataSource.refresh() call will not fail. For me, it happened only in a table that uses (userRowSelect) event.