dt.on function Expected 2 arguments, but got 3

dt.on function Expected 2 arguments, but got 3

joshhsiaojoshhsiao Posts: 2Questions: 2Answers: 0

Debugger code (debug.datatables.net):

import type { Api } from 'datatables.net'
let dt: Api<any>
onMounted(() => {
  // Get a DataTables API reference
  if (dataTable.value) {
    dt = dataTable.value.dt
  }
  // Activate an inline edit on click of a table cell
  dt.on('click', 'tbody td:not(:first-child)', function () {
    editor?.inline(this, {
      onBlur: 'submit'
    })
  })
})

Error messages shown:
Expected 2 arguments, but got 3.
Description of problem:
I follow example of vue3 and pass 'tbody td:not(:first-child)' as argument, but the Typescript complain dt.on function expected 2 arguments, but got 3.

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    That's an error in our Typescript file - apologies. As a workaround for the moment do:

    (dt as any).on('click', ...
    

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
Sign In or Register to comment.