Topic: Recommendation: columns variable explanation required

softcon premium asked 5 months ago


Datatable - Async data https://mdbootstrap.com/docs/standard/data/datatables/#docsTabsOverview

In the example provided you use "const columns" variable for the columns, and reference it like this:

  const asyncTable = new mdb.Datatable(
     document.getElementById('datatable'),
     { columns, },  <-----------note parameter name only
     { loading: true }
  );

I changed the variable name to "columns_set1" because I had multiple tables. However I didn't realise that by changing the column name I had to reference it differently.

  const asyncTable = new mdb.Datatable(
     document.getElementById('datatable'),
     { columns_set1, },  <-----this is wrong
     { columns:  columns_set1, },  <-----this is correct

     { loading: true }
  );

It might be good to write in the documentation that if the column parameter name is not "column" then the descriptor "columns: " is required beforehand.

Or it was me just being dumb :)


Grzegorz Bujański staff answered 5 months ago


Thanks for the feedback. This is one of the things that came with ES6. Most liners now require this syntax. e.g. ESLint: https://eslint.org/docs/latest/rules/object-shorthand

However we will discuss it in the team :)



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • User: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.11.0
  • Device: pc
  • Browser: all
  • OS: windows 10
  • Provided sample code: No
  • Provided link: Yes