@@ -31,4 +31,10 @@ trait SortableTrait | |||
$this->position = $position; | |||
return $this; | |||
} | |||
public function clearPosition(): self | |||
{ | |||
$this->position = null; | |||
return $this; | |||
} | |||
} |
@@ -23,13 +23,13 @@ function initSovSortableList() { | |||
$(li).append(newForm); | |||
$(li).find('#form_entities_' + index + '_id').val($(li).data('id')); | |||
if ($('.sov-sortable').data('parent-position') !== '') { | |||
/* if ($('.sov-sortable').data('parent-position') !== '') { | |||
//Ajout d'un 0 initial pour les nuémros <10 | |||
indexAsString = index.toString().padStart(2, '0'); | |||
val = $('.sov-sortable').data('parent-position') + '.' + indexAsString | |||
} else { | |||
} else {*/ | |||
val = index; | |||
} | |||
//} | |||
$(li).find('#form_entities_' + index + '_position').val(val); | |||
}); | |||
@@ -48,8 +48,8 @@ | |||
{% block body %} | |||
<div class="table-responsive"> | |||
<table class="table table-bordered table-hover table-striped sov-sortable" | |||
data-parent-position="{{ ea.entity is defined and ea.entity.instance is not null ? ea.entity.instance.position : '' }}"> | |||
<table class="table table-bordered table-hover table-striped sov-sortable"> | |||
{# data-parent-position="{{ ea.entity is defined and ea.entity.instance is not null ? ea.entity.instance.position : '' }}" #} | |||
<thead> | |||
{% block table_head %} | |||
<tr> |