![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
nestable-fork
Advanced tools
Drag & drop hierarchical list with mouse and touch compatibility
Just another fork of Nestable jQuery plugin developed by David Bushell then updated by Ramon Smit who deleted the repository later.
This covers the latest version. Some features may be added in the near future.
Via bower:
$ bower install --save nestable-fork
Via npm:
$ npm install --save nestable-fork
Write your nested HTML lists like so:
<div class="dd">
<ol class="dd-list">
<li class="dd-item" data-id="1">
<div class="dd-handle">Item 1</div>
</li>
<li class="dd-item" data-id="2">
<div class="dd-handle">Item 2</div>
</li>
<li class="dd-item" data-id="3">
<div class="dd-handle">Item 3</div>
<ol class="dd-list">
<li class="dd-item" data-id="4">
<div class="dd-handle">Item 4</div>
</li>
<li class="dd-item" data-id="5">
<div class="dd-handle">Item 5</div>
</li>
</ol>
</li>
</ol>
</div>
Then activate with jQuery like so:
$('.dd').nestable({ /* config options */ });
The change
event is fired when items are reordered.
$('.dd').on('change', function() {
/* on change event */
});
You can get a serialised object with all data-*
attributes for each item.
$('.dd').nestable('serialize');
The serialised JSON for the example above would be:
[{"id":1},{"id":2},{"id":3,"children":[{"id":4},{"id":5}]}]
You can get a hierarchical nested set model like below.
$('.dd').nestable('asNestedSet');
The output will be like below.
[{"id":1,"parent_id":"","depth":0,"lft":1,"rgt":2},{"id":2,"parent_id":"","depth":0,"lft":3,"rgt":4},{"id":3,"parent_id":"","depth":0,"lft":5,"rgt":10},{"id":4,"parent_id":3,"depth":1,"lft":6,"rgt":7},{"id":5,"parent_id":3,"depth":1,"lft":8,"rgt":9}]
You can change the follow options:
maxDepth
number of levels an item can be nested (default 5
)group
group ID to allow dragging between lists (default 0
)callback
callback function when an element has been changed (default null
)These advanced config options are also available:
contentCallback
The callback for customizing content (default function(item) {return item.content || '' ? item.content : item.id;}
)listNodeName
The HTML element to create for lists (default 'ol'
)itemNodeName
The HTML element to create for list items (default 'li'
)rootClass
The class of the root element .nestable()
was used on (default 'dd'
)listClass
The class of all list elements (default 'dd-list'
)itemClass
The class of all list item elements (default 'dd-item'
)dragClass
The class applied to the list element that is being dragged (default 'dd-dragel'
)noDragClass
The class applied to an element to prevent dragging (default 'dd-nodrag'
)handleClass
The class of the content element inside each list item (default 'dd-handle'
)collapsedClass
The class applied to lists that have been collapsed (default 'dd-collapsed'
)noChildrenClass
The class applied to items that cannot have children (default 'dd-nochildren'
)placeClass
The class of the placeholder element (default 'dd-placeholder'
)emptyClass
The class used for empty list placeholder elements (default 'dd-empty'
)expandBtnHTML
The HTML text used to generate a list item expand button (default '<button data-action="expand">Expand></button>'
)collapseBtnHTML
The HTML text used to generate a list item collapse button (default '<button data-action="collapse">Collapse</button>'
)includeContent
Enable or disable the content in output (default false
)listRenderer
The callback for customizing final list output (default function(children, options) { ... }
- see defaults in code)itemRenderer
The callback for customizing final item output (default function(item_attrs, content, children, options) { ... }
- see defaults in code)json
JSON string used to dynamically generate a Nestable list. This is the same format as the serialize()
output[{"id": 1, "content": "First item", "classes": ["dd-nochildren", "dd-nodrag", ...] }, ... ]
)change
behaviour with a callbackel.closest
instead of el.parents
maxDepth
option (default to 5)listClass
and itemClass
.group
option to enabled the above.Install node and npm following one of the techniques explained within this link and run the commands below.
$ npm install --global gulp-cli && npm install
$ gulp
Copyright © 2012 David Bushell | BSD & MIT license
FAQs
Drag & drop hierarchical list with mouse and touch compatibility
The npm package nestable-fork receives a total of 0 weekly downloads. As such, nestable-fork popularity was classified as not popular.
We found that nestable-fork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.