Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit ef6c0a9

Browse files
committed
docs(data_table): note button_to alternative and column toggle reset
1 parent 239627a commit ef6c0a9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

app/views/docs/data_table.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def view_template
206206
end
207207
end
208208

209+
p { "For simpler bulk actions that include CSRF and Turbo confirms out of the box, you can use Rails' #{code(class: "font-mono text-xs") { "button_to" }} helper — e.g. #{code(class: "font-mono text-xs") { 'button_to "Delete", path, method: :delete, form: {data: {turbo_confirm: "..."}}' }} — the button will carry a nested form that submits to the given path." }
210+
209211
Heading(level: 3) { "Rails controller example" }
210212
p { "Your endpoint receives the selected IDs as params[:ids] (an array of strings):" }
211213

@@ -228,6 +230,7 @@ def bulk_export
228230
# ── Example 5: Column visibility ──────────────────────────────────────
229231
Heading(level: 2) { "Column visibility" }
230232
p(class: "-mt-6") { "Client-side toggle. Hidden columns get `hidden` class via data-column attribute matching." }
233+
p { "Column visibility is client-side and resets on every Turbo Frame swap (sort/search/page re-renders). If you need it to persist, encode it in a URL param (e.g. `?columns=name,status`) or store in localStorage." }
231234

232235
render Docs::VisualCodeExample.new(title: "Column visibility", context: self) do
233236
<<~RUBY

0 commit comments

Comments
 (0)