$fields = $this->entity['list']['fields']; | $fields = $this->entity['list']['fields']; | ||||
$paginator = $this->findAll($this->entity['class'], $this->request->query->get('page', 1), 500, $this->request->query->get('sortField'), $this->request->query->get('sortDirection'), $this->entity['list']['dql_filter']); | $paginator = $this->findAll($this->entity['class'], $this->request->query->get('page', 1), 500, $this->request->query->get('sortField'), $this->request->query->get('sortDirection'), $this->entity['list']['dql_filter']); | ||||
dump($paginator->getCurrentPageResults()); | |||||
$this->dispatch(EasyAdminEvents::POST_LIST, ['paginator' => $paginator]); | $this->dispatch(EasyAdminEvents::POST_LIST, ['paginator' => $paginator]); | ||||
$positionForm = $this->createFormBuilder(array('entities', $paginator->getCurrentPageResults())) | $positionForm = $this->createFormBuilder(array('entities', $paginator->getCurrentPageResults())) |
{ | { | ||||
/** | /** | ||||
* @var string | * @var string | ||||
* @ORM\Column(type="integer") | |||||
* @ORM\Column(type="float") | |||||
*/ | */ | ||||
protected $position = 0; | protected $position = 0; | ||||
/** | /** | ||||
* @return int | |||||
* @return float | |||||
*/ | */ | ||||
public function getPosition(): int | |||||
public function getPosition(): float | |||||
{ | { | ||||
return $this->position; | return $this->position; | ||||
} | } | ||||
/** | /** | ||||
* @param int $position | |||||
* @param float $position | |||||
* @return $this | * @return $this | ||||
*/ | */ | ||||
public function setPosition(int $position): self | |||||
public function setPosition(float $position): self | |||||
{ | { | ||||
$this->position = $position; | $this->position = $position; | ||||
return $this; | return $this; |
$(li).append(newForm); | $(li).append(newForm); | ||||
$(li).find('#form_entities_' + index + '_id').val($(li).data('id')); | $(li).find('#form_entities_' + index + '_id').val($(li).data('id')); | ||||
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '_' + index | |||||
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '.' + index | |||||
else val = index; | else val = index; | ||||
log($(li).find('#form_entities_' + index + '_position')); | |||||
$(li).find('#form_entities_' + index + '_position').val(val); | $(li).find('#form_entities_' + index + '_position').val(val); | ||||
}); | }); | ||||