npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xe3-nested-sortable

v1.0.1

Published

NestedSortable is a jQuery plugin that extends jQuery Sortable UI functionalities to nested lists.

Downloads

3

Readme

nestedSortable jQuery plugin

nestedSortable is a jQuery plugin that extends jQuery Sortable UI functionalities to nested lists.

Meteor Installation

meteor add ilikenwf:nested-sortable

What's new in version 2.0

The biggest change is that your nested list can now behave as a tree with expand/collapse funcionality. Simply set isTree to true in the options and you are good to go! Check the demo out to see what can be done with nestedSortable and a little CSS. (Note that all nestedSortable does is to assign/remove classes on the fly)
Also:

  • isAllowed function finally works as expected, see the docs below
  • Fixed: a small bug in the protectRoot function
  • Changed: no drop zone will appear at all if you try to nest an item under another one that has the no-nesting class.
  • Added: doNotClear option to prevent the plugin from deleting empty lists

Features

  • Designed to work seamlessly with the nested set model (have a look at the toArray method)
  • Items can be sorted in their own list, moved across the tree, or nested under other items.
  • Sublists are created and deleted on the fly
  • All jQuery Sortable options, events and methods are available
  • It is possible to define elements that will not accept a new nested item/list and a maximum depth for nested items
  • The root level can be protected
  • The parentship of items can be locked, just as if it was a family tree.

Usage

<ol class="sortable">
	<li><div>Some content</div></li>
	<li>
		<div>Some content</div>
		<ol>
			<li><div>Some sub-item content</div></li>
			<li><div>Some sub-item content</div></li>
		</ol>
	</li>
	<li><div>Some content</div></li>
</ol>
	$(document).ready(function(){

		$('.sortable').nestedSortable({
			handle: 'div',
			items: 'li',
			toleranceElement: '> div'
		});

	});

Please note: every <li> must have either one or two direct children, the first one being a container element (such as <div> in the above example), and the (optional) second one being the nested list. The container element has to be set as the 'toleranceElement' in the options, and this, or one of its children, as the 'handle'.

Also, the default list type is <ol>.

This is the bare minimum to have a working nestedSortable. Check the demo out to see what can be accomplished with a little more.

Custom Options

Custom Classes (you will set them in the options as well)

Custom Methods

Events

Known Bugs

nestedSortable doesn't work properly with connected draggables, because of the way Draggable simulates Sortable mouseStart and mouseStop events. This bug might or might not be fixed some time in the future (it's not specific to this plugin).

Requirements

jQuery UI Sortable 1.10+ (might work with 1.9, but not tested)

Browser Compatibility

Tested with: Firefox, Chrome
NOTE: This is still an alpha version, please test thoroughly in whichever version of IE you target

License

This work is licensed under the MIT License.
Which means you can do pretty much whatever you want with it.