No longer maintained
Online demo at http://taginput.injectionsoft.com/
Put `tagInput.css` and `tagInput.js` to public directory and link them to the layout. For example, you might use:
<link rel="stylesheet" media="screen,projection,tv" href="{$basePath}/css/tagInput.css" type="text/css">
<script type="text/javascript" src="{$basePath}/js/tagInput.js"></script>
then, insert `TagInput.php` anywhere your RobotLoader looks for classes. In your `BasePresenter.php::startup()` register this component with:
\Nette\Forms\TagInput::register();
now, you may simply add this control to any `\Nette\Forms\Form` using
$form->addTag('tags')
->setDefaultValue($page->tags);
Autocomplete
Set the callback function via the setter
$form->addTag('tag')
->setSuggestCallback(function($filter, $count) { ... }); // or callback
You have create an action on the presenter (or mutual ancestor of presenters) where you want to used this control.
public function actionTagInputSuggestControlname($filter)
{
$form = $this->getComponent('componentname');
$form['controlname']->renderResponse($this, $filter);
}
don’t forget to change Controlname in both action name and the array key. Componentname figures only in the getComponent() call.
License – Original BSDCopyright © Mikuláš Dítě, 2011
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
This software is provided by author as is and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。