(Ruby、Rails、Javascript)拖放而不干扰服务器......?
使用“draggable_element”时是否有等效的“link_to_function”(而不是“:action”)? 基本上我需要拖放一些项目并将其反映在本地而不联系服务器。
我当前的设置是有两个带有各种列表项的 DIV。 我有一个充满 domids“points[selected][name]”的项目和另一个带有 domids“points[available][name]”的 div。 我需要在它们之间拖放而不咨询服务器。 只有在保存时我才想打扰服务器。
我看过类似项目上的所有RailsCast,但它似乎不包括从“draggable_element”方法触发的非标准操作(即辅助函数)。
提前致谢!
Is there an equivalent of "link_to_function" (instead of ":action") when using "draggable_element"? Basically I need to drag and drop some items and have it reflected locally without contacting the server.
My current setup is that I have two DIVs with various list items. I have one full of items with domids "points[selected][name]" and another div with domids "points[available][name]". I need to drag and drop between them without consulting the server. Only on save do I wish to bother the server.
I've watched all the RailsCasts on similar items, but it doesn't seem to cover having a non-standard action (i.e. Helper Function) triggered from a "draggable_element" method.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从心底里想说:不要使用 Rails 提供的助手。 因为您需要自定义操作,所以编写您自己的 JS 来执行 UI 操作。
好吧,虽然没什么帮助,但我认为这是最好的方法。
From the top of my head I would say: don't use the helper that rails provides. Write your own JS to do the UI manipulation since you need a custom action.
Okay, not that helpfull, but I think it's the best way.
在我的脑海中,您不能省略 sortable_element 调用中的 :action 并在提交表单时包含新的排序顺序吗?
Off the top of my head, can't you just omit the :action from the sortable_element call and include the new sort order when you submit your form?