2017 © Pedro Peláez
 

library typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

image

vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  • Friday, July 13, 2018
  • by vojtys
  • Repository
  • 1 Watchers
  • 2 Stars
  • 677 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 11 % Grown

The README.md

Typeahead

Typeahead (twitter/typeahead.js) for Nette framework, (*1)

Install

$ composer require vojtys/typeahead

Versions

State Version Branch Nette PHP
stable v0.4.1 master 3.0+ >=7.1
stable v0.3.3 master 2.4 >=5.6

Configuration

extensions:
    typehead: Vojtys\Forms\Typeahead\TypeaheadExtension

typeahead:
    limit: 10
    minLength: 2
    highlight: true

Usage

Presenter/Control


public function createComponentTypeaheadForm(): Form { $form = new Form(); /** @var TypeaheadInput $typeahead */ // name, label, display (input displayed value), suggestion callback $typeahead = $form->addTypeahead('typeahead', 'Typeahead', 'title', function($display, $q) { return $this->searchBy($q); // returns array result [title => 'foo', description => 'foo foo'] }); $typeahead->setPlaceholder('Začni psát...'); // initial placeholder // add handlebars templates (http://handlebarsjs.com/) // suggestion template $typeahead->setSuggestionTemplate(function(Html $template) { $inner = Html::el('div')->setText('{{title}} – {{description}}'); return $template->addHtml($inner); }); // empty template $typeahead->setNotFoundTemplate(function(Html $template) { $inner = Html::el('div')->setText('nic tu neni'); return $template->addHtml($inner); }); $form->addSubmit('ok', 'Odeslat'); return $form; }

css

<link rel="stylesheet" type="text/css" href="https://www.example.com/vendor/vojtys/assets/css/typeahead.css">

js

Before </body> element., (*2)

<!-- nette.ajax.js -->
<script src='https://www.example.com/vendor/vojtys/assets/js/nette.ajax.js'></script>
<!-- handlebars.js -->
<script src='https://www.example.com/vendor/vojtys/assets/js/handlebars.min-v4.7.3.js'></script>
<!-- typehead.js -->
<script src='https://www.example.com/vendor/vojtys/assets/js/typeahead.js'></script>
<script src='https://www.example.com/vendor/vojtys/assets/js/vojtys.typeahead.js'></script>

The Versions

13/07 2018

dev-master

9999999-dev https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

13/07 2018

v0.3.3

0.3.3.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

03/11 2016

v0.3.2

0.3.2.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

03/09 2015

v0.3.1

0.3.1.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

17/07 2015

v0.3.0

0.3.0.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

15/07 2015

v0.2.3

0.2.3.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

14/07 2015

v0.2.2

0.2.2.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

14/07 2015

v0.2.1

0.2.1.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček

14/07 2015

v0.2

0.2.0.0 https://github.com/vojtys/typeahead

Typeahead (twitter/typeahead.js) for Nette - Forms

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Vojtěch Sedláček