I am trying to implement a custom sortable with jquery but it does not seem to work.The code is bellow.What is wrong,the elements are not sortables,that mean that the js code does not work
<?php
$this->registerJsFile('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
$this->registerJs("$('#sortable').sortable({
axis: 'y',
update: function (event, ui) {
var data = $(this).sortable('serialize');
// POST to server using $.post or $.ajax
$.ajax({
data: data,
type: 'POST',
url: '/your/url/here'
});
}
});");
?>
<ul id="sortable">
<?php foreach ($model as $row) {?>
<li id="item-<?php echo $row['id'] ?>"><?php echo $row['name']; ?></li>
<?php }?>
</ul>
[edit]It seems that I did not import the jquery-ui.js [/edit]