-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Motivation:
to be able to use the 'count' of selected items in button text or other customised selection text.
specifically this code:
countValueChanged(count) {
this.element.toggleAttribute("hidden", count === 0);
this.countTarget.textContent = count;
this.singularTarget.toggleAttribute("hidden", count !== 1);
this.pluralTarget.toggleAttribute("hidden", count === 1);
}
was thinking something like this:
countValueChanged(count) {
this.element.toggleAttribute("hidden", count === 0);
this.countTargets.forEach((el) => el.textContent = count; });
this.singularTargets.forEach((el) => el.toggleAttribute("hidden", count !== 1); });
this.pluralTargets.forEach((el) => el.toggleAttribute("hidden", count === 1); });
}
The other problem is how to use this feature nicely in the view.
(not nice example)
<%= table_selection_with(collection:) do %>
<%= tag.button formaction: "#", formmethod: :get do %>
<span data-<%= Katalyst::Tables::Selectable::FormComponent.new(collection:).send(:form_target, "count") %>>0</span>
Hello
<% end %>
<%= tag.button "Activate", formaction: "#", formmethod: :put %>
<% end %>
Metadata
Metadata
Assignees
Labels
No labels