Topic: Hidden columns in Datatable reappear on column sort and pagination

scottwilliams priority asked 3 months ago

Maybe I'm just doing it wrong?

Expected behavior

Hidden columns in Datatable remain hidden regardless of column sorting or pagination changes.

Actual behavior

Columns reappear on column sorting and pagination changes but column headers remain hidden as expected.

Resources (screenshots, code snippets etc.)


Grzegorz Bujański staff answered 3 months ago

Check this snippet: It's look like datatableInstance.update(); in showColumns function is unnecessary and caused this issue

scottwilliams priority commented 3 months ago

Aw crap! That was an artifact from a previous solution that I missed removing. Thank you for the second set of eyes! :D It works perfectly.

Grzegorz Bujański staff answered 3 months ago

Datatable re-renders when you use sorting or pagination. But you can use render.mdb.datatable event and hide the columns when it is called.

scottwilliams priority commented 3 months ago

Yep. I tried that but when I do it runs away and loops until the browser freezes. Any thoughts on where I can put it to avoid the endless looping?

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.1.0
  • Device: Macbook Pro
  • Browser: Chrome
  • OS: MacOS Sonoma 14.3
  • Provided sample code: No
  • Provided link: Yes