contributte / forms-multiplier

:repeat: Form multiplier & replicator for Nette Framework

Home Page:https://contributte.org/packages/contributte/forms-multiplier.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It refreshes the page when add or remove container.

matrixinfologics opened this issue · comments

It refreshes the page which takes a little while and mainly the page jumps back to the top - in case that when adding many items this might get quite anyoing. Please suggest me solution.

The simplest solution is snippets

$multiplier->addRemoveButton('Remove', function (Nette\Forms\Controls\SubmitButton $button) {
	$button->setHtmlAttribute('class', 'ajax');
	$button->onClick[] = function () {
		$this->redrawControl('mySnippet');
	};
});
$multiplier->addCreateButton('Create', 1, function (Submitter $button) {
	$button->setHtmlAttribute('class', 'ajax');
	$button->onClick[] = function () {
		$this->redrawControl('mySnippet');
	};
});