unisharp / dndsort
帮助构建有序列表项。
dev-master
2015-10-14 19:20 UTC
This package is auto-updated.
Last update: 2024-09-15 14:47:50 UTC
README
通过jQuery帮助构建有序列表项。
安装
- 此插件需要jQuery和jQuery-UI
初始化
-
生成列表项
$('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 });
-
在列表中生成新项
$('#new-data').click(function(){ $('#sortable').dndsort('new'); });
-
生成排序数据
$('#submit').click(function(){ $('#sortable').dndsort('save'); });
这将使输入如下所示
<input type='text' name='sorted' value='sorted_data_in_json'>
设置属性
待办事项
- 添加对未列出项的支持。