本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9811

getting-started

できること

このスキルは、TanStack Tableを使ってEmberアプリにデータの表を作る方法を示します。表のレイアウトにそのライブラリを使いたいEmberの開発者向けです。

使う場面

  • ✓記録の表を表示する必要があるEmberのページを作っているとき。
  • ✓表のスタイルとして、Emberのテンプレートタグのコンポーネントを使いたいとき。
  • ✓表のデータがトラックされたプロパティに保存されていて、画面で更新される必要があるとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/TanStack/table/blob/main/packages/ember-table/skills/getting-started/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Emberアプリに、ユーザーの一覧を表示する表が必要です。TanStack Tableをどう設定すればよいでしょうか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

列を定義し、表を作り、テンプレートで行とセルをループさせるコンポーネントの例を示します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

Ember 5.8 or newer requires Embroider or ember-auto-import v2. Prefer .gts or .gjs template-tag components with Glint.

Setup

import Component from '@glimmer/component'
import { tracked } from '@glimmer/tracking'
import {
  FlexRenderCell,
  createColumnHelper,
  tableFeatures,
  useTable,
  type Cell,
  type Row,
} from '@tanstack/ember-table'

type Person = { id: string; name: string }

const features = tableFeatures({})
const columnHelper = createColumnHelper<typeof features, Person>()
const columns = columnHelper.columns([
  columnHelper.accessor('name', { header: 'Name' }),
])
const initialData: Person[] = [{ id: '1', name: 'Ada' }]
const getRowId = (row: Person) => row.id

const getAllCells = (
  row: Row<typeof features, Person>,
): Array<Cell<typeof features, Person>> => row.getAllCells()

export default class PeopleTable extends Component {
  @tracked data = initialData

  table = useTable(this, () => ({
    features,
    columns,
    data: this.data,
    getRowId,
  }))

  get rows() {
    return this.table.getRowModel().rows
  }

  <template>
    <table>
      <tbody>
        {{#each this.rows as |row|}}
          <tr>
            {{#each (getAllCells row) as |cell|}}
              <td><FlexRenderCell @cell={{cell}} /></td>
            {{/each}}
          </tr>
        {{/each}}
      </tbody>
    </table>
  </template>
}

Construction and rendering

useTable takes an options thunk. Read tracked data inside it, and keep features, atoms, and columns stable. In a component, pass this as the owner to bind external-atom cleanup to the component lifecycle. The one-argument thunk form remains available for standalone tables.

Read Table APIs in template-consumed getters. Column, row, cell, and header prototype methods require their receiver, so use a getter or module helper such as getAllCells(row) rather than an extracted method. Wrap event calls the same way.

Use FlexRenderCell, FlexRenderHeader, and FlexRenderFooter for the matching object. Rendered components receive @ctx and optional @options through flexRenderComponent(Component, options).

With tableFeatures({}), render row.getAllCells(). Register columnVisibilityFeature before switching to row.getVisibleCells().

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/ember-table/declarations/index.d.ts, use-table.d.ts, signal.d.ts, and FlexRender.d.ts. Core feature APIs are in node_modules/@tanstack/table-core/dist/features/.

よくある質問

どのEmberのバージョンが必要ですか?

スキルは、Ember 5.8以降ではEmbroiderまたはember-auto-import v2が必要だとしています。

.gtsファイルを使うべきですか?

型チェックのためにGlintを使い、.gtsまたは.gjsファイルでテンプレートタグのコンポーネントを使うことを勧めています。

表のデータはどこから来ますか?

例では、データをトラックされたプロパティに保存するので、その変更が表に反映されます。

詳細

作者による元の説明

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

repo: TanStack/table

人気

GitHubのスター
29k
ランキング
#9811
ライセンス
MIT
更新日
2026/10/21

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル