Prečo handle pre závislý select nevracia snippety
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Čamo
- Člen | 798
Zdravím,
vie mi prosím niekto povedať, prečo mi handle z presentera nevracia snippet
pre závislý select? Pritom tam mám jeden testovací snippet a ten normálne
príde v odpovedi zo servera. V presentery mám toto:
public function actionCreate()
{
$this->template->_form = $this['rewardForm'];
$this->template->test = 'This is the default value.'; // test snippet
$this->template->setFile( __DIR__ . '/../templates/Reward/edit.latte');
}
public function handleAttribute( $value )
{
//$this->template->setFile( __DIR__ . '/../templates/Reward/edit.latte');
$this->template->test = 'Do prdele co sa deje???'; // ok
if( $this->isAjax() )
{
if ( $value )
{
$attributes = $this->rewardService->attributesToFormSelect( $value );
$this['rewardForm']['attribute']->setPrompt('')->setItems( $attributes );
Debugger::log($this['rewardForm']['attribute']); // ok
}
else
{
$this['rewardForm']['attribute']->setPrompt('Select from first')->setItems(['bla' => 'bla', 'hijoooo' => 'hijoooo']);
}
$this->redrawControl('wrapper'); // nothing
$this->redrawControl('attributes'); // nothing
$this->redrawControl('test'); // ok
}
}
A v šablone mám
{snippetArea wrapper}
{form rewardForm}
<div class="alert alert-dismissible alert-danger fade in" n:if="$form->hasErrors()">
<button type="button" class="close" data-dismiss="alert"><span>×</span></button>
<div n:foreach="$form->errors as $error">{$error}</div>
</div>
<div class="row mV10">
<div class="col-sm-3 tAR">{label resource}{/label}</div>
<div class="col-sm-4">{input resource}</div>
</div>
<div class="row mV10">
<div class="col-sm-3 tAR">{label attribute}{/label}</div>
<div class="col-sm-4">{snippet attributes}{input attribute}{/snippet}</div>
</div>
<div class="row mV10">
<div class="col-sm-4 col-sm-offset-3">{input submit}</div>
</div>
{/form}
{/snippetArea}
- David Matějka
- Moderator | 6445
@Čamo tak aspon ze to funguje. mimochodem
Snippet attributes tam je. Nieje tam wrapper.
tohle je v poradku, snippetArea se nevypisuje do html