Changing class of select by $renderer->wrappers
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Casper
- Člen | 253
You can see possible wrappers in DefaultFormRenderer.
There is no .select
in there. So I guess, you cannot do this by
wrappers.
- KingKoca
- Člen | 25
But you can create your own renderer by extending DefaultFormRenderer class and override init() function, where you can enable adding class to select by $wrappers[‚control‘][‚.select‘]. I did it like this:
protected function init()
{
parent::init();
$wrapper = & $this->wrappers['control'];
foreach ($this->form->getControls() as $control) {
// add class to selectbox
if($control instanceof \Nette\Forms\Controls\SelectBox){
$control->controlPrototype->class($wrapper['.select'],TRUE);
}
}
}