question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: $(_this.el.nativeElement).DataTable is not a function. (In '$(_this.el.nativeElement).DataTable(dtOptions)', '$(_this.el.nativeElement).DataTable' is undefined

See original GitHub issue

I’m submitting a…


[*] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Question

Current behavior

In installed all the requirements to import angular datatable as provided in doc. But after importing when i added a basic table in my angular 6 project nothig works and error is flagged in console!

screen shot 2018-09-17 at 11 22 43 am

Why this happen any fix for this! Is this an issue still open?

app-module.ts

import { DataTablesModule } from 'angular-datatables';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ReactiveFormsModule,
    DataTablesModule.forRoot(),
    ContextMenuModule.forRoot({
      useBootstrap4: true,
    }),
    AppRoutingModule,
    HttpClientModule
  ],
  providers: [
    AuthGuard,
    AuthService,
    UserService,
    {
      provide: HTTP_INTERCEPTORS,
      useClass: JwtInterceptor,
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Environment


- node version: v8.11.3
- angular version: 6
- angular-cli version: 6.1.5
- jquery version: 3.3.6
- datatables version: 1.10.19
- angular-datatables version: 6.00

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
pawelalikowskicommented, Oct 22, 2018

in angular-datatables/src/angular-datatables.directive.ts should be import of jquery

import * as $ from 'jquery'

0reactions
stale[bot]commented, Dec 13, 2020

This issue has been closed due to inactivity. Please feel free to re-open the issue to add new inputs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DataTable is not a function TypeError while ... - Stack Overflow
Hi are you sure the _this is correctly setted with your this of the component? .. have you tried something like:
Read more >
Uncaught TypeError: $(…).DataTable is not a function (when ...
I'm trying to use https://datatables.net/ jquery datatables for my angular 5 project to nicely display some data.
Read more >
TypeError: $(...).DataTable is not a function in jQuery
The "$(...).DataTable is not a function" jQuery error occurs for multiple reasons: Forgetting to include the DataTables library. Loading the DataTables library ...
Read more >
DataTable is not a function TypeError while using angular ...
Coding example for the question DataTable is not a function TypeError while using angular-datatables for Angular 4-angular.js.
Read more >
Developers - TypeError: $(_this.el.nativeElement).DataTable is not a ...
nativeElement).DataTable is not a function. (In '$(_this.el.nativeElement).DataTable(dtOptions)', '$(_this.el.nativeElement).DataTable' is undefined.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found