-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snippet redraw not working with BootstrapRenderer #10
Comments
Can you send some error message that you get? or maybe whole presenter file? |
There is no error message. And the whole presenter file looks like this. <?php
namespace App\Modules\Admin\Presenters;
use Nette;
use Tomaj\Form\Renderer\BootstrapRenderer;
class SimplePresenter extends Nette\Application\UI\Presenter {
public function createComponentSimpleForm() {
$form = new Nette\Application\UI\Form();
$form->setRenderer(new BootstrapRenderer);
$form->getElementPrototype()->class('ajax');
$form->addText('text', 'Text');
$form->addSubmit('submit', 'Submit');
$form->onSuccess[] = array($this, 'onSuccess');
return $form;
}
public function onSuccess(Nette\Application\UI\Form $form) {
$form->setValues(array(), TRUE);
$this->redrawControl('form');
}
} and for template {**
* @param string $basePath web base path
* @param array $flashes flash messages
*}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{ifset title}{include title|striptags} | {/ifset}Nette Sandbox</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="{$basePath}/css/style.css">
<meta name="viewport" content="width=device-width">
{block head}{/block}
</head>
<body>
<div n:foreach="$flashes as $flash" n:class="flash, $flash->type">{$flash->message}</div>
<div class="container">
{snippet form}
{control simpleForm}
{/snippet}
</div>
{block scripts}
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="{$basePath}/bower_components/nette.ajax.js/nette.ajax.js"></script>
<script src="{$basePath}/js/main.js"></script>
{/block}
</body>
</html> and inside main.js is only this: $(function () {
$.nette.init();
}); and this is what i get inside the response from server:
|
im encountering this how do you fix this ? |
When used any of BootstrapRenderers, snippet redraw sends the message but actual redraw never happens.
Presenter:
Template:
All files are included,
$.nette.init()
called, other snippets redraws are working.After commenting out line with
$form->setRenderer(...)
its works properly. Also when DefaultFormRenderer is used, everything works as expected.The text was updated successfully, but these errors were encountered: