Topic: Restoring a sortable grid from saved preferences
OllyJS
free
asked 2 weeks ago
I store an ordered list of item identifiers for each workspace. The grid currently initializes before the saved order arrives.
Should I reorder elements before creating the sortable instance?
Igor Przybysz
staff
answered 2 weeks ago
Yes, if you control initial rendering, wait for the saved preferences, arrange the real card elements in that order, and then create the sortable instance. This avoids initializing against one layout and immediately replacing or rearranging its elements afterward. Keep stable card IDs so that newly added or deleted cards can be reconciled with an older saved sequence.
For data that must arrive later, please show whether your renderer moves existing nodes or replaces the entire grid. The correct update or recreation strategy depends on that distinction. Keep the grid in a loading state until its initial order is ready to avoid a visible jump.
https://mdbootstrap.com/docs/standard/plugins/drag-and-drop/
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 7.1.0
- Device: Desktop
- Browser: Edge
- OS: Windows 11
- Provided sample code: No
- Provided link: No