Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)29k · #9817

getting-started

Skill này làm gì

Skill này chỉ cách xây dựng một bảng dữ liệu trong ứng dụng Octane bằng TanStack Table. Skill dành cho lập trình viên dùng Octane và cú pháp template TSRX.

Khi nào nên dùng

  • ✓Khi bạn đang xây dựng một trang Octane hiển thị danh sách các bản ghi trong bảng.
  • ✓Khi bạn cần bảng hiển thị tiêu đề và ô qua helper render của nó.
  • ✓Khi bạn muốn định nghĩa các cột của bảng bằng một helper cột trong file TSRX.

Liên kết skill

https://github.com/TanStack/table/blob/main/packages/octane-table/skills/getting-started/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/TanStack/table/blob/main/packages/octane-table/skills/getting-started/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi đang xây dựng một trang Octane hiển thị danh sách sản phẩm trong bảng. Tôi thiết lập nó như thế nào?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill đưa ra một component mẫu có các cột và dữ liệu, rồi lặp qua các tiêu đề, hàng và ô trong markup để hiển thị trên trang.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Load intent load @tanstack/table-core#core first for the headless model, stable inputs, and column inference.

Setup

import { createRoot, useState } from 'octane'
import {
  createColumnHelper,
  tableFeatures,
  useTable,
} from '@tanstack/octane-table'

type Person = { name: string }
const features = tableFeatures({})
const helper = createColumnHelper<typeof features, Person>()
const columns = helper.columns([helper.accessor('name', { header: 'Name' })])

function PeopleTable() @{
  const [data] = useState<Person[]>([{ name: 'Ada' }])
  const table = useTable({ features, columns, data })

  <table>
    <thead>
      @for (const group of table.getHeaderGroups(); key group.id) {
        <tr>
          @for (const header of group.headers; key header.id) {
            <th><table.FlexRender header={header} /></th>
          }
        </tr>
      }
    </thead>
    <tbody>
      @for (const row of table.getRowModel().rows; key row.id) {
        <tr>
          @for (const cell of row.getAllCells(); key cell.id) {
            <td><table.FlexRender cell={cell} /></td>
          }
        </tr>
      }
    </tbody>
  </table>
}

const rootElement = document.getElementById('root')
if (!rootElement) throw new Error('Root element not found')
createRoot(rootElement).render(PeopleTable)

Construction and rendering

This adapter distributes authored TypeScript and TSRX. Configure the consumer with octane() in vite.config.ts and the TSRX JSX import source octane. Author component bodies with @{ ... } and keyed @for loops for rows, headers, and cells.

Import from @tanstack/octane-table. Render table.FlexRender as a component so it gets its own Octane scope. It preserves numbers including 0, render descriptors, and component functions.

Keep features and column definitions at module scope. For inputs that depend on component state, use useMemo; pass the current stable data array to useTable. Convert non-renderable values with String(value) when displaying them as text.

Read for the task

  • When adding or configuring optional features, load intent load @tanstack/table-core#table-features and read only references for the requested behavior.
  • For state ownership or reactive reads, read table-state.
  • When tables share features, defaults, or reusable UI, read create-table-hook.

API discovery

Inspect node_modules/@tanstack/octane-table/src/index.d.ts, the matching *.tsrx.d.ts sidecar, and src/types.ts. This package publishes authored source; core APIs are in installed @tanstack/table-core/dist/.

Câu hỏi thường gặp

TSRX là gì?

Các ví dụ được viết bằng TSRX, cú pháp component mà adapter này dùng, nên trông khác với JSX thông thường.

Bảng lấy dữ liệu từ đâu?

Ví dụ giữ dữ liệu trong state của Octane bằng useState và truyền nó cho bảng.

Điều này có thay thế hướng dẫn bảng cốt lõi không?

Không. Nó giả định bạn đã đọc hướng dẫn cốt lõi về mô hình bảng không giao diện (headless) trước.

Chi tiết

Mô tả gốc của tác giả

Create and render Table v9 with the octane adapter. Route reusable createTableHook components, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

Độ phổ biến

Sao GitHub
29k
Vị trí xếp hạng
#9817
Giấy phép
MIT
Cập nhật
21/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự