Agents & OrchestrationSûr100100/100

Column Ordering (TanStack)

Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.

ou envoie-le directement à ton agent.

Installer dans ton projet

$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs column-ordering__tanstack-table__packages-table-core-skills-01224304a32c
TanStack
TanStack/table
Contenu à copier
---
name: column-ordering
description: >
  Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.
metadata:
  origin: TanStack
  { type: sub-skill, library: '@tanstack/table-core', library_version: '9.2.4' }
requires: ['core', 'table-features']
sources:
  - 'TanStack/table:docs/framework/react/guide/column-ordering.md'
  - 'TanStack/table:packages/table-core/src/features/column-ordering'
  - 'TanStack/table:examples/react/column-dnd'
---

This skill builds on `core` and `table-features`. `columnOrder` orders unpinned leaf IDs; other plugins can still determine the final visual regions.

## Setup

```ts
import { columnOrderingFeature, tableFeatures } from '@tanstack/table-core'

export const features = tableFeatures({ columnOrderingFeature })
export const initialState = { columnOrder: ['name', 'age', 'actions'] }
```

## Core Patterns

```ts
const next = columnOrder.filter((id) => id !== activeId)
next.splice(next.indexOf(overId), 0, activeId)
table.setColumnOrder(next)
```

Use column IDs as drag identities and replace the array.

## Common Mistakes

### [HIGH] Assuming state is final order

Wrong: `renderIds(columnOrder)`

Correct: `renderColumns(table.getAllLeafColumns())`

Pinning regions and grouping mode apply after base ordering. If
`columnVisibilityFeature` is also registered, render
`table.getVisibleLeafColumns()` to apply visibility too.

Source: `docs/framework/react/guide/column-ordering.md#what-affects-column-order`

### [HIGH] Using labels as identities

Wrong: `const activeId = column.columnDef.header as string`

Correct: `const activeId = column.id`

Headers can collide or change; ordering state stores stable leaf column IDs.

Source: `packages/table-core/src/features/column-ordering/columnOrderingFeature.types.ts`

### [HIGH] Mutating controlled state in place

Wrong: `columnOrder.splice(0, 1); table.setColumnOrder(columnOrder)`

Correct: `table.setColumnOrder(columnOrder.slice(1))`

Reactive owners commonly require a new array reference.

Source: `examples/react/column-dnd/src/main.tsx`

## API Discovery

Inspect `node_modules/@tanstack/table-core/dist/features/column-ordering/`; combine with pinning/visibility skills when those plugins are registered.
Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.

Ce que fait Column Ordering (TanStack)

Applique les pratiques du skill column-ordering__tanstack-table__packages-table-core-skills-01224304a32c.

Comment utiliser Column Ordering (TanStack)

1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.

Déclencheurs pour Column Ordering (TanStack)

Dis simplement à ton agent quelque chose comme :

Applique le skill column-ordering__tanstack-table__packages-table-core-skills-01224304a32c à cette tâche
Utilise column-ordering__tanstack-table__packages-table-core-skills-01224304a32c pour améliorer cette implémentation
Passe en revue ce sujet avec column-ordering__tanstack-table__packages-table-core-skills-01224304a32c

Skills liés à Column Ordering (TanStack)