在Codeigniter中,我尝试从包表中更改packageValue的值。首先,我根据packageValue从包表中获取列表包。 packageValue,例如1,2,3等。如果packageValue具有1,则必须在顶部查看。之后,2,3等。当我使用drap&drop时,我想更改这些值。我想显示这个packageValue的值。我怎样才能做到这一点?
拖放视图:
<!-- Default items sorting -->
<div class="card card-body border-top-info">
<div class="text-center">
<h6 class="font-weight-semibold mb-0">Drag & Drop</h6>
<p class="mb-3 text-muted">Drag the package you want to level up on other packages. This will take the package you are dragging from the other packages to the next level.</p>
</div>
<div class="dropdown-menu dropdown-menu-sortable" style="display: block; position: static; width: 100%; margin-top: 0; float: none;">
<?php foreach($all_packs as $get) { ?>
<li class="dropdown-item"><?php echo $get->packageNameEn; ?> <?php echo '#'. ' ' ?><span><?php echo $get->packageValue; ?></span></li>
<?php } ?>
</div>
</div>
<!-- /default items sorting -->
Javascript:
<script>
$(function () {
$(".dropdown-menu-sortable").sortable({
onDrop: function ($item, container, _super, event) {
$('.dropdown-menu-sortable li').removeClass('dragged');
$("body").removeClass('dragging');
$('.dropdown-item span').each(function (i) {
var humanNum = i + 1;
$(this).html(humanNum + '');
});
}
});
});
</script>