Sort Collection Via Event Handler: Revision history

Jump to: navigation, search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

17 April 2025

  • curprev 20:1720:17, 17 April 2025Admin talk contribs 1,412 bytes +24 No edit summary
  • curprev 19:5519:55, 17 April 2025Admin talk contribs 1,388 bytes +1,388 Created page with "<source> defmodule AppWeb.SandboxLive do use AppWeb, :live_view alias App.TestBeds alias App.TestBeds.TestBed alias App.Repo import Ecto.Query def mount(_params, _session, socket) do testbeds = Repo.all(from(t in TestBed, order_by: t.name)) {:ok, assign(socket, testbeds: testbeds, sort_by: :name, sort_direction: :asc)} end def handle_event("toggle_sort_by_name", _params, socket) do current_direction = socket.assigns.sort_direction new_..."