How to use the sortablejs function in sortablejs

To help you get started, we’ve selected a few sortablejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maodouio / meteor-react-redux-base / maodou / singlePages / client / containers / admin / singlePagesConf / config / section.js View on Github external
setState({ beginUpload: false, fileUploaded: false});
            },
            // 'Key': function(up, file) {
            //   // 若想在前端对每个文件的key进行个性化处理,可以配置该函数
            //   // 该配置必须要在 unique_names: false , save_key: false 时才生效
            //
            //   var key = "";
            //   // do something with key here
            //   return key
            // }
          }
        });
      }
    });

    new Sortable(el, {
      sort: true,  // sorting inside list
      delay: 0, // time in milliseconds to define when the sorting should start
      store: {
        set: (sortable) => {
          const order = sortable.toArray();
          Meteor.call('singlePages.changeIndex', order);
        }
      },
      animation: 150,  // ms, animation speed moving items when sorting, `0` — without animation
      dataIdAttr: 'data-id'
    });
  }
};
github mobov / guitor / packages / creator / src / components / previewer / comp-suit.vue View on Github external
init () {
        this.initSuits()
        const $sortContainer = this.node.name === 'HView' ? this.$el.children[0] : this.$el

        this.$sortable = new Sortable($sortContainer, {
          group: this.nodeUid,
          draggable: '.comp-suit',
          // sort: false,
          // Element is dropped into the list from another list
          // Changed sorting within list
          // onUpdate: this.handleDragUpdate,
          onSort: this.handleDragSort
        })
      },
      handleDragSort (e) {
github taylorhakes / sparkgrid / src / plugins / ReorderColumns.js View on Github external
movableInit() {
		this._header = this._grid.getHeader();

		if (this._sortable) {
			this._sortable.destroy();
		}

		this._sortable = new Sortable(this._header, {
			onUpdate: this._boundHandleDragEnd,
			animation: 300
		});
	}
github BookStackApp / BookStack / resources / js / components / book-sort.js View on Github external
const bookGroupConfig = {
            name: 'book',
            pull: ['book', 'chapter'],
            put: ['book', 'chapter'],
        };

        const chapterGroupConfig = {
            name: 'chapter',
            pull: ['book', 'chapter'],
            put: function(toList, fromList, draggedElem) {
                return draggedElem.getAttribute('data-type') === 'page';
            }
        };

        for (let sortElem of sortElems) {
            new Sortable(sortElem, {
                group: sortElem.classList.contains('sort-list') ? bookGroupConfig : chapterGroupConfig,
                animation: 150,
                fallbackOnBody: true,
                swapThreshold: 0.65,
                onSort: this.updateMapInput.bind(this),
                dragClass: 'bg-white',
                ghostClass: 'primary-background-light',
            });
        }
    }
github orchidsoftware / platform / resources / js / controllers / fields / upload_controller.js View on Github external
initSortable() {
        new Sortable(document.querySelector(this.dropname + ' .sortable-dropzone'), {
            animation: 150,
            onEnd: () => {
                this.resortElement();
            },
        });
    }
github netgen-layouts / layouts-core / bundles / LayoutsAdminBundle / Resources / es6 / components / rules.js View on Github external
sortStart() {
        this.rules.ids.forEach(id => this.rules.byId[id].onSortingStart());
        this.appContainer.classList.add('sorting');
        [...document.getElementsByClassName('nl-rule-between')].forEach(el => el.parentElement.removeChild(el));
        this.sortable = new Sortable(this.rulesContainer, {
            draggable: '> .nl-rule',
            direction: 'vertical',
            animation: 150,
            onEnd: (e) => {
              this.moveRule(e.oldIndex, e.newIndex);
            },
        });
        this.initialOrder = this.sortable.toArray();
    }
github BookStackApp / BookStack / resources / assets / js / components / shelf-sort.js View on Github external
initSortable() {
        const scrollBoxes = this.elem.querySelectorAll('.scroll-box');
        for (let scrollBox of scrollBoxes) {
            new Sortable(scrollBox, {
                group: 'shelf-books',
                ghostClass: 'primary-background-light',
                animation: 150,
                onSort: this.onChange.bind(this),
            });
        }
    }

sortablejs

JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.

MIT
Latest version published 4 months ago

Package Health Score

95 / 100
Full package analysis