Skip to content

timmd909/knockout-sortablejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THIS IS MY PERSONAL BRANCH OF AN ABANDONED PROJECT.

Use at your own risk. It works for me with my needs. Message me if it helps you, and I'll think about taking over the maintainer role. I wonder if I'm on the one using it still...

Original project: https://github.com/SortableJS/knockout-sortablejs


knockout-sortablejs fork

A Knockout.js binding to SortableJS.

Support KnockoutJS

Include knockout-sortable.js

<div data-bind="sortable: {foreach: yourObservableArray, options: {/* sortable options here */}}">
	<!-- optional item template here -->
</div>

<div data-bind="draggable: {foreach: yourObservableArray, options: {/* sortable options here */}}">
	<!-- optional item template here -->
</div>

Using this bindingHandler sorts the observableArray when the user sorts the HTMLElements.

The sortable/draggable bindingHandlers supports the same syntax as Knockouts built in template binding except for the data option, meaning that you could supply the name of a template or specify a separate templateEngine. The difference between the sortable and draggable handlers is that the draggable has the sortable group option set to {pull:'clone',put: false} and the sort option set to false by default (overridable).

Other attributes are:

  • options: an object that contains settings for the underlaying sortable, ie group,handle, events etc.
  • collection: if your foreach array is a computed then you would supply the underlaying observableArray that you would like to sort here.
  • manuallyHandleUpdateEvents: a boolean to turn off the change events on update that other polymer elements listen to.

NPM

npm install knockout-sortablejs

About

A Knockout.js binding to SortableJS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 72.2%
  • HTML 27.8%