You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Export a selection hook for content inside Table (useTableSelection) #22
Table keeps the row selection in a private TableContext (selected, the registered row ids, toggle). Packages that put content in bulkForm (bulk-actions' action bar) can't read it, so they can't show "3 selected" or "All 20 on this page are selected — select all 1,234?" without reading the DOM.
Asked for: export a hook for content rendered inside Table, e.g.
exportfunctionuseTableSelection(): {model: stringselected: ReadonlySet<string>// checked row idsrows: ReadonlySet<string>// registered, enabled row idssetSelected: (ids: Iterable<string>)=>void// e.g. clear after "all matching" is cancelled}|null
Why: the bulk-actions bar (@javaabu/bulk-actions' BulkActionsBar, rendered in bulkForm) shows the selected count and offers "select all matching" when every row on the page is checked.
Not blocking: bulk-actions currently counts with new FormData(form).getAll("articles[]") on change/click events of the surrounding form, which works with the HTML and Onu adapters. With the hook it would switch to it.
useTableSelection(): TableSelection | null is exported from @javaabu/forms, with the shape you asked for: { model, selected, rows, setSelected }. selected and rows are ReadonlySet<string>, rows holds the registered rows with an enabled checkbox, and setSelected(ids) replaces the selection. Outside a Table it returns null.
bulkForm content was rendered outside the table's context before this change, so the context provider now wraps the whole table, including bulkForm, beforeTable and pagination. Covered by a test in src/components/listing.test.tsx and documented in docs/basic-usage/listing.md#reading-the-selection and the Boost skill's listing reference.
Activity
Custom field hooks, useTableSelection, Blade icon names
n4ff4h commentedon Nov 5, 2026
Done in 204e616 on
next-gen(PR #19), CI green: https://github.com/Javaabu/react-forms/actions/runs/42055926515useTableSelection(): TableSelection | nullis exported from@javaabu/forms, with the shape you asked for:{ model, selected, rows, setSelected }.selectedandrowsareReadonlySet<string>,rowsholds the registered rows with an enabled checkbox, andsetSelected(ids)replaces the selection. Outside aTableit returnsnull.bulkFormcontent was rendered outside the table's context before this change, so the context provider now wraps the whole table, includingbulkForm,beforeTableandpagination. Covered by a test insrc/components/listing.test.tsxand documented indocs/basic-usage/listing.md#reading-the-selectionand the Boost skill's listing reference.