# react-mixin-sortablejs **Repository Path**: mirrors_SortableJS/react-mixin-sortablejs ## Basic Information - **Project Name**: react-mixin-sortablejs - **Description**: React mixin for SortableJS. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-09-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # THIS PROJECT NEEDS A MAINTAINER. --- react-mixin-sortablejs ------------------- React mixin for [SortableJS](https://github.com/RubaXa/Sortable/). Demo: http://rubaxa.github.io/Sortable/ ### Support React Include [react-sortable-mixin.js](react-sortable-mixin.js). See [more options](react-sortable-mixin.js#L26). ```jsx var SortableList = React.createClass({ mixins: [SortableMixin], getInitialState: function() { return { items: ['Mixin', 'Sortable'] }; }, handleSort: function (/** Event */evt) { /*..*/ }, render: function() { return } }); ReactDOM.render(, document.body); // // Groups // var AllUsers = React.createClass({ mixins: [SortableMixin], sortableOptions: { ref: "user", group: "shared", model: "users" }, getInitialState: function() { return { users: ['Abbi', 'Adela', 'Bud', 'Cate', 'Davis', 'Eric'] }; }, render: function() { return (

Users

); } }); var ApprovedUsers = React.createClass({ mixins: [SortableMixin], sortableOptions: { group: "shared" }, getInitialState: function() { return { items: ['Hal', 'Judy'] }; }, render: function() { return } }); ReactDOM.render(

, document.body); ``` ### Support React ES2015 / TypeScript syntax As mixins are not supported in ES2015 / TypeScript syntax here is example of ES2015 ref based implementation. Using refs is the preferred (by facebook) "escape hatch" to underlaying DOM nodes: [React: The ref Callback Attribute](https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute) ```js import * as React from "react"; import Sortable from 'sortablejs'; export class SortableExampleEsnext extends React.Component { sortableContainersDecorator = (componentBackingInstance) => { // check if backing instance not null if (componentBackingInstance) { let options = { handle: ".group-title" // Restricts sort start click/touch to the specified element }; Sortable.create(componentBackingInstance, options); } }; sortableGroupDecorator = (componentBackingInstance) => { // check if backing instance not null if (componentBackingInstance) { let options = { draggable: "div", // Specifies which items inside the element should be sortable group: "shared" }; Sortable.create(componentBackingInstance, options); } }; render() { return (

Group 1

Swap them around
Swap us around
Swap things around
Swap everything around

Group 2

Swap them around
Swap us around
Swap things around
Swap everything around
); } } ```