https://github.com/unisharp/dndsort
jquery drop and drag sort plugin
https://github.com/unisharp/dndsort
Last synced: 9 days ago
JSON representation
jquery drop and drag sort plugin
- Host: GitHub
- URL: https://github.com/unisharp/dndsort
- Owner: UniSharp
- Created: 2015-10-14T00:53:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-14T19:21:07.000Z (over 10 years ago)
- Last Synced: 2025-01-10T12:49:10.143Z (over 1 year ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dndsort
Help building sorted list items by jQuery.
## Installation
* this plugin requires jQuery and jQuery-UI
## Initialization
* generate list items :
```javascript
$('ul#sortable').sortable();
$('#sortable').dndsort('init', {
data : [], // set your items
submit_name : 'sorted', // set sorted input field name
labels : {}, // set labels for new item and buttons
attrs : {}, // set attributes for list and buttons
render : func_render // set custom rendering function
});
```
* generate new item in list
```javascript
$('#new-data').click(function(){
$('#sortable').dndsort('new');
});
```
* generate sorted data
```javascript
$('#submit').click(function(){
$('#sortable').dndsort('save');
});
```
this make input like below :
```html
```
## Setting Attributes
## Todo
* Add support for not-listed items.