Skip to content

[v3] preInit/preXhr events are not caught outside of constructor #383

@miken32

Description

@miken32

This code worked in version 2:

$('#example')
    .on(
        "preInit.dt",
        function() {console.log("preInit");}
      )
    .DataTable();

This code does not work in version 3:

new DataTable('#example')
    .on(
        "preInit.dt",
        function() {console.log("preInit");}
      );

I guess because the table is already instantiated by the time on() is called. This works fine, as expected:

new DataTable('#example', {
    on: {
        "preInit.dt",
        function() {console.log("preInit");}
   }
});

Not sure if the method I was using with v2 is unusual or not – maybe this isn't a bug at all – but I thought I'd mention it as a stumbling block I came across during the update to 3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions