Sorting UI

HTML:

<!-- Sorting -->
<div id="modal_sorting" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modal_sorting_label" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="modal_sorting_label">排序</h3>
	</div>
	<div class="modal-body">
		<ul class="sortable">
		</ul>
	</div>
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true">關閉</button>
		<button id="bt_delete" class="btn btn-primary bt_submit" data-dismiss="modal">儲存</button>
	</div>
</div>

CSS:

.sortable{
	list-style: none;
	margin: 0px;
	padding: 0px;
	min-width: 100px;
}
.sortable li{
	margin: 0 3px 3px 3px; 
	padding: 0.4em; 
	padding-left: 1.5em; 
	font-size: 1.4em; 
	height: 18px;
	overflow: hidden;
}
.sortable li span{
	position: absolute; 
	margin-left: -1.3em;
}

Javascript:

var sorting = {
	get_modal: function(){
		return $('#modal_sorting');
	}, 
	get_list: function(){
		return this.get_modal().find('.sortable');
	}, 
	init: function(){
		var wrap = this;
		var $modal = wrap.get_modal();

		$modal.find('.bt_submit').on('click', function(e){
			wrap.update();
		});
	}, 
	show: function(node_id, parent_id){
		var wrap = this;
		var $modal = wrap.get_modal();
		var $list = wrap.get_list();

		$modal.modal();
		$modal.data({
			id: node_id, 
			parent_id: parent_id
		});

		var params = {
			parent_id: parent_id
		}
		$.post('services/cat/get_children.php', params, function(data){
			//console.log(data);
			$list.children().remove();

			var items = data.data;
			for(var i = 0; i < items.length; i++){
				var item = items[i];
				//console.log(item);
				$list.append(
					'<li class="ui-state-default" data-id="' + item.id + '">' + 
					'<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>' + 
					item.title + 
					'</li>'
				);

			}
			
			$list.sortable();
		});
	}, 
	get_sorting: function(){
		var wrap = this;
		var $list = wrap.get_list();
		var sorting = [];

		$list.find('li').each(function(index){
			var $this = $(this);
			sorting.push($this.attr('data-id'));
		});

		return sorting;
	}, 
	update: function(){
		var wrap = this;
		var $modal = wrap.get_modal();
		var $list = wrap.get_list();

		var params = {
			parent_id: $modal.data().parent_id, 
			sorting: JSON.stringify(wrap.get_sorting())
		}
		//console.log(params);
		//return;

		$.post('services/cat/update_sorting.php', params, function(data){
			//console.log(data);
			window.location.reload();
		});
	}
}