(Ruby, Rails, Javascript) Drag and drop without listening to the server ...?

Is there an equivalent to "link_to_function" (instead of ": action") when using "draggable_element"? Basically I need to drag and drop some elements and reflect it locally, without accessing the server.

My current setup is that I have two DIVs with different list items. I have one full points with dominas of "points [selected] [name]" and another div with domids of "points [available] [name]". I need to drag between them without accessing the server. I only want to worry about the server.

I looked at all the RailsCasts on similar elements, but it doesn’t seem to mean that a non-standard action (that is, a helper function) is triggered from the "draggable_element" method.

Thanks in advance!

+4
source share
2 answers

From head to toe I would say: do not use the assistant who provides the rails. Write your own JS to manipulate the user interface, since you need to perform your own action.

Well, not so useful, but I think this is the best way.

+1
source

Above my head, can't you just omit the action from the call to sortable_element and enable the new sort order when submitting your form?

0
source

Source: https://habr.com/ru/post/1286260/


All Articles