I am using live view to render a table:
<table>
<thead>
<tr>
<th>#</th>
<%= for c <- @columns do %>
<th>
<%= tr(c.display_name, 32) %>
</th>
<% end %>
<th></th>
</tr>
</thead>
<tbody>
<%= for {r, rnum} <- @rows_index do %>
<tr class="<%= if rnum == @selected_y do "selected" end %>">
<td><%= rnum + 1 %></td>
<%= for {val, cnum} <- r do %>
<td phx-click="select_cell"
phx-value-x="<%= cnum %>"
phx-value-y="<%= rnum %>"
class="<%= if cnum == @selected_x && rnum == @selected_y do "selected" end %>">
<%= val %></td>
<% end %>
<td></td>
</tr>
<% end %>
</tbody>
</table>
I have about 150 columns and 10 000 rows.
The problem is that when I do the select_cell
call, and update selected_x
and selected_y
the update takes a few seconds.
Is there a way to optimize this with live view, or should I move to JS?