how to reduce treeview with checkboxes load time


Topic: how to reduce treeview with checkboxes load time

LISTAFIRME pro premium priority asked 10 months ago

load in less than 2s

loading in 8+s

I have a treeview with almost 1000 nodes representing NACE rev2 and it loads in 400ms simple or in 8.4s if it has checkboxes, which is a lot. I'm interested in whether this time can be improved because other trees with checkboxes are much faster. I don't know how they are managed internally but I know that an array of 1000 checkboxes is much faster than 1000 separate checkboxes. I'm asking for advice on how to load faster because 8 seconds is not acceptable. NACE Rev2.1 has around 1200 nodes and I'm scared of how long it will take. Take a look: https://listafirme.ro/firme-industrii.asp


Bartosz Cylwik staff answered 10 months ago

Hi!

I tested the treeview on a fresh app with about 1300 nodes and unfortunately it's the same thing for me.

I dont think we can do anything about this without changes to the plugin itself. I have added this issue to our list and we will check why it takes so long and if we can do anything to make it faster but I cannot give you an ETA for this.

As of things you can try, maybe some kind of pagination or lazy loading would work there?

Best Regards!


LISTAFIRME pro premium priority answered 10 months ago

I saw this before. It might be much faster to use array of objects instead of thousand of distinct objects. I'm looking for the next version :)


LISTAFIRME pro premium priority answered 7 days ago

I optimized Treeview initialization in MDB Pro 9.3.0. The original plugin creates a Collapse instance for every expandable branch. Each constructor searches globally for collapse triggers, repeatedly processing branches that have already been initialized. This becomes expensive on large trees.

The modified plugin: - Temporarily removes data-mdb-collapse-init from a branch trigger after its Collapse instance has registered it. - Excludes Treeview-generated checkboxes without collapse targets from these repeated searches. - Applies the same treatment to triggers in previously initialized Treeview instances, supporting multiple trees on one page. - Restores every attribute and its exact value synchronously in a finally block, including when initialization throws an error.

Collapse controls outside Treeview remain available during initialization. Existing MDB instances, trigger associations and event handlers are preserved. The change is limited to initialization. It preserves the existing selection, accordion, keyboard, filtering and expand/collapse logic.

Optimized MDB Treeview initialization by temporarily excluding already registered branch triggers and targetless checkboxes from repeated global Collapse searches. All attributes are restored synchronously in finally, including on error.

The optimization supports multiple trees and all existing options, while preserving external Collapse controls, event handlers and runtime behavior. Delivered as https://listafirme.ro/platform-static/mdbuipro930/plugins/js/treeview-lf.min.js the original vendor file remains unchanged.

If it helps you, please offer a piece of candy to anyone.


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: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 9.2.0
  • Device: PC
  • Browser: Chrome
  • OS: W11
  • Provided sample code: No
  • Provided link: Yes
Tags