Filtering data for paginated datatable

After you push_patch, handle_params will be called. You are setting the min/max to nil every time. So you need to get the min & max from the params in handle_params and you don’t want to be assigning the products in the filter event.

In the event you push_patch with the URL params you want and do all the assigning in handle_params.

Something like this:

def handle_event("filter", %{"min" => min, "max" => max}, socket) do

    socket =
      push_patch(socket,
        to:
          Routes.release_notes_index_path(
            socket,
            :index,
            page: socket.assigns.options.page,
            per_page: socket.assigns.options.per_page,
            min: min,
            max: max
          )
      )

    {:noreply, socket}
  end