unisharp/dndsort

Help building sorted list items.

Installs: 38

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 6

Forks: 1

Open Issues: 0

Language:JavaScript

dev-master 2015-10-14 19:20 UTC

This package is auto-updated.

Last update: 2024-12-15 15:23:02 UTC


README

Help building sorted list items by jQuery.

Installation

  • this plugin requires jQuery and jQuery-UI

Initialization

  • generate list items :

    	$('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

    	$('#new-data').click(function(){
    	  $('#sortable').dndsort('new');
    	});
  • generate sorted data

    	$('#submit').click(function(){
    	  $('#sortable').dndsort('save');
    	});

    this make input like below :

    	<input type='text' name='sorted' value='sorted_data_in_json'>

Setting Attributes

Todo

  • Add support for not-listed items.