dtInstance doesn't exist on dtElement [the angular way]
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
What versions you are using?
- angular version: 4.4.6
- angular-datatables version: 4.4.1
Hi there, I’m trying to reproduce the behavior shown in this example. The issue that I’m dealing with is located here:
this.dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance.destroy();
this.dtTrigger.next();
});
Where dtInstance doesn’t exist on dtElement. Any idea of what I could be missing?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Angular Dtinstance Doesnt Exist On Dtelement (forked)
example for dtInstance doesn't exist on dtElement in angular-datatables.
Read more >re-initialize angular 6 datatable shows this.dtElement undefined
Here is my solution, the order of ViewChild/dtElement/... is ... dtElement: DataTableDirective; dtOptions: any = {}; dtInstance: DataTables.
Read more >Error on api.rows().select() method angular datatables
i execute the next code: dtInstance.clear(); console.log("--Limpiando tabla--") //Destroying the table dtInstance.destroy(); //Calling dtTrigger ...
Read more >cannot read properties of undefined (reading 'dtinstance')
I am trying to add a new button to datatable DOM in angular using renderer2. But its triggering an error in runtime saying....
Read more >Datatable Server Side in Angular doesn't populate table properly
dtElement.dtInstance.then((dtInstance: DataTables.Api) => { dtInstance.destroy(); this.dtTrigger.next(); }); } catch (err) { console.log(err); } }.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The annotation
@ViewChild(DataTableDirective)
must be just above your variable…It’s a metadata for you variable. Its placement is important…
@l-lin Thank you for the reply. I actually figured that out a couple days ago after a lot of experimenting. Ultimately, instead of using
@ViewChild
, since I had two datatables in my component, I had to do the following to get access to both of the tables:Then, because only one of the tables needs to be rerendered, I only put the [dtTrigger] attribute on that table and called this in my controller function:
I ended up having to use setTimeout() because my data is asynchronous. Now it works as expected