PHP code example of necris / selectt
1. Go to this page and download the library: Download necris/selectt library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
necris / selectt example snippets
$(function(){
$('.select2-ajax').each(function () {
let params = $(this).data().select2Params;
params.ajax = {
url: $(this).data('select2-url'),
dataType: 'json'
};
$(this).select2(params);
});
$('.select2-ajax-multi').each(function () {
let params = $(this).data().select2Params;
params.ajax = {
url: $(this).data('select2-url'),
dataType: 'json'
};
$(this).select2(params);
});
});
public function createComponentAutocomplete(): SelecttAutocompleteControl
{
$a = new SelecttAutocompleteControl(new ArrayDataSource([
1 => "Praha",
2 => "Brno",
3 => "Paříž",
4 => "Hitler",
5 => "patří",
6 => "za",
7 => "mříž"
]));
$a->enableEmptyQuery();
return $a;
}
public function createComponentForm(): Nette\Application\UI\Form
{
$f = new Nette\Application\UI\Form();
$f->addText("text", "text");
$f->addSelect2("select2", $this['autocomplete'], "Best select in the world");
$f->addSelect2Multi("select2multi", $this['autocomplete'], "Best multiselect ever");
.
.
.
return $f;
}