admin管理员组文章数量:1313133
I'm trying to create a navigation menu editor prised of multiple nested, sortable forms that will ultimately be submitted en masse as one giant nested JSON data blob containing all of the form data.
The two libraries I'm examining are nestableSortable () and Nestable (). These two libraries seem to be the most monly used projects for this type of work, however neither seems to have built-in functionality for serializing and nesting these forms. Right now I'm under the assumption that either library will require me to somehow build this functionality myself.
Nestable appears to be a bit newer and doesn't depend on JQuery-UI, while nestableSortable appears to be a bit more feature-rich. I'm also wondering if anyone has had a similar issue with nested forms and whether they have any tips on how to get either of these libraries to easily serialize nested forms into a JSON structure, and whether either of these libraries is better suited for such a project.
I'm trying to create a navigation menu editor prised of multiple nested, sortable forms that will ultimately be submitted en masse as one giant nested JSON data blob containing all of the form data.
The two libraries I'm examining are nestableSortable (https://github./mjsarfatti/nestedSortable) and Nestable (https://github./dbushell/Nestable). These two libraries seem to be the most monly used projects for this type of work, however neither seems to have built-in functionality for serializing and nesting these forms. Right now I'm under the assumption that either library will require me to somehow build this functionality myself.
Nestable appears to be a bit newer and doesn't depend on JQuery-UI, while nestableSortable appears to be a bit more feature-rich. I'm also wondering if anyone has had a similar issue with nested forms and whether they have any tips on how to get either of these libraries to easily serialize nested forms into a JSON structure, and whether either of these libraries is better suited for such a project.
Share Improve this question asked Mar 4, 2013 at 16:49 blackbournablackbourna 1,2432 gold badges16 silver badges29 bronze badges 1- Users searching for this topic should also be informed of the existence of two forks of Nestable - RamonSmit's fork, github./RamonSmit/Nestable2 - and ImLiam's fork of RS's fork (which seems to currently be maintained): github./ImLiam/Nestable. Both of these seem to do lft/rgt attributes in addition to parent for deployment of nestable-model type sorting / searching (as opposed to adjacencies model). – James Commented Nov 25, 2018 at 14:17
2 Answers
Reset to default 5If anyone is interested, after further inspection I found that Nestable requires this format in order to work:
<div class="dd">
<ol class="dd-list">
<li class="dd-item" data-id="1">
<div class="dd-handle">Item 1</div>
</li>
</ol>
</div>
I wasn't particularly pleased with the idea that the JS library would be so strict regarding required element attributes, as I felt that the Javascript should handle this somewhat independently of the markup. Because of this, I wound up choosing nestedSortable over the Nestable library.
Further, nestedSortable appears to have useable properties for left/right/parent attributes for nodes in the tree, which may be helpful on the server side when performing tree manipulations.
I started with nestedSortable and then switched to nestable. I am now switching back to nestedSortable because it is patible down to IE7 (a project requirement). Yes, it is easy to appreciate the more minimalistic structure of nestable, however, be sure to test with your target browser(s) before mitting to either of these (excellent) utilities.
BTW, both have the ability to serialize their data (nestable has one, nestedSortable has multiple).
本文标签: javascriptnestableSortable vs Nestable JS libraryStack Overflow
版权声明:本文标题:javascript - nestableSortable vs Nestable JS library - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741913788a2404601.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论