LearnNewsExamplesServices
Frontmatter
id9407
titleCreate `Neo.grid.column.Tree` & Cell Component
stateClosed
labels
enhancementdesignaigrid
assigneestobiu
createdAtMar 9, 2026, 11:52 AM
updatedAtMar 9, 2026, 5:20 PM
githubUrlhttps://github.com/neomjs/neo/issues/9407
authortobiu
commentsCount2
parentIssue9404
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 9, 2026, 5:20 PM

Create Neo.grid.column.Tree & Cell Component

Closed v12.1.0 enhancementdesignaigrid
tobiu
tobiu commented on Mar 9, 2026, 11:52 AM

Goal

Implement the specialized column renderer for Tree Grids, using a nested component architecture to handle indentation, toggle states, and event emission without breaking Row Pooling.

Details

  1. src/grid/column/Tree.mjs:

    • Extends Neo.grid.column.Component.
    • Defaults to using Neo.grid.column.tree.Component.
    • Implements expand(record) and collapse(record) proxy methods to forward the interaction to the TreeStore.
  2. src/grid/column/tree/Component.mjs:

    • Extends Neo.component.Base.
    • VDOM Structure: Indentation Spacer (CSS variable bound), Toggle Icon (CSS class bound), and Content Node.
    • Reacts to record changes (during scroll recycling) to update its internal depth, expanded, and isLeaf states.
  3. SCSS Implementation (src + 5 themes):

    • src/.../Component.scss: Structural flex layout and CSS calc() for indentation.
    • theme-*/.../Component.scss: Define FontAwesome icons for expanded/collapsed states using ::before pseudo-elements.
  4. Interaction & Events:

    • Add click delegation on the toggle icon.
    • The column must trigger the expansion/collapse via the TreeStore.
    • Crucial: The TreeStore (or the column itself) must fire expand and collapse events.
    • These events should bubble up to (or be explicitly fired on) the grid.Container so developers can easily listen to them in their View Controllers (e.g., onNodeExpand, onNodeCollapse).
tobiu added the enhancement label on Mar 9, 2026, 11:52 AM
tobiu added the design label on Mar 9, 2026, 11:52 AM
tobiu added the ai label on Mar 9, 2026, 11:52 AM
tobiu added the grid label on Mar 9, 2026, 11:52 AM
tobiu added parent issue #9404 on Mar 9, 2026, 11:52 AM
tobiu
tobiu Mar 9, 2026, 12:09 PM

Input from Gemini 3.1 Pro:

Implementation Guidance for Agents:

When implementing the styling for this component, you MUST adhere to the Neo.mjs split styling architecture:

  1. Structural Layout (resources/scss/src/grid/column/tree/Component.scss):

    • This file should ONLY contain layout rules (Flexbox alignment, margins).
    • Use a CSS calc() with a variable for indentation: width: calc(var(--tree-depth, 0) * var(--tree-indent, 16px));
  2. Theme Variables (resources/scss/theme-*/grid/column/tree/Component.scss):

    • You must create this file for ALL 5 themes (theme-neo-dark, theme-neo-light, theme-neo-light-rich, theme-neo-dark-rich, theme-epona).
    • Define the actual CSS variables (e.g., --tree-indent) here.
    • Define the visual icons using ::before pseudo-elements and the content property mapped to FontAwesome unicode values (e.g., content: '\f054' for collapsed, \f078 for expanded).

Important Files to Reference:

  • Look at src/grid/column/Component.mjs to understand how the cell recycling works via afterSetRecord.
  • Look at resources/scss/theme-neo-dark/grid/column/IconLink.scss for an example of how to scope theme-specific column styling.
tobiu assigned to @tobiu on Mar 9, 2026, 12:10 PM
tobiu referenced in commit 78767bb - "feat(grid): Create Neo.grid.column.Tree & Cell Component (#9407)" on Mar 9, 2026, 5:19 PM
tobiu
tobiu Mar 9, 2026, 5:19 PM

Input from Gemini 3.1 Pro:

✦ I have implemented Neo.grid.column.Tree and Neo.grid.column.component.Tree. The cell component handles visual state updating (indents via depth_, CSS icons via isLeaf_ & expanded_). Click events on the toggle delegate back to the gridContainer, which subsequently triggers store.expand() and store.collapse(), as well as explicit expand/collapse events emitted on the grid itself.

I've also used NeoArray.remove(cls, ['is-expanded', 'is-collapsed', 'is-leaf']) as suggested! Closing this issue as complete.

tobiu closed this issue on Mar 9, 2026, 5:20 PM
tobiu referenced in commit 19771c9 - "fix(grid): Correct Tree theme folders and apply missing baseCls (#9407) on Mar 9, 2026, 8:48 PM
tobiu referenced in commit 524bb31 - "fix(grid): Correct themes, fix baseCls layout, and add TreeGrid demo (#9407) (#9410) on Mar 9, 2026, 8:48 PM