承接 evosoftcz/form-selectize 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evosoftcz/form-selectize

最新稳定版本:3.1.0

Composer 安装命令:

composer require evosoftcz/form-selectize

包简介

Form extension for Nette framework

README 文档

README

Form extension for Nette framework

More documentations

Requirements

  • Nette 3.0
  • PHP 7.2+
  • jQuery 1.8+
  • Selectize.js - included with more features

Installation

The best way to install evosoftcz/form-selectize is using Composer:

    "repositories": [
		{
			"url": "https://github.com/evosoftcz/form-selectize.git",
			"type": "git"
		}
	],
    "require": {
		"evosoftcz/form-selectize": "^2.0"
	},

After installation server site, you have to install client site.

Link selectize.init.js from client-side and selectize.js and call somewhere function selectize().

Last step is enable the extension using your neon config

extensions:
	selectize: Selectize\Form\Control\SelectizeExtension

Default configuration

selectize:
	mode: full # second mode is `select` for selection just 1 option
	create: on
	maxItems: null
	delimiter: #/
	plugins:
		- remove_button
	valueField: id
	labelField: name
	searchField: name

Data in array for full mode

array (2)
	0 => array (2)
		id => 1
		name => "First item"
	1 => array (2)
		id => 2
		name => "Second item"

id is set as valueField and name as labelField and searchField in config.neon. You can use whatever, have to just set in config.neon or in addSelectize method. For example:

valueField: slug

Data in array for select mode

Data for select mode are same as for SelectBox:

array (2)
	1 => "First item",
	2 => "Second item"

Using

Default settings from config.neon

$form->addSelectize('tags', 'štítky', $arrayData);

custome settings in method first way (array)

$form->addSelectize('tags', 'štítky', $arrayData, ['create' => false, 'maxItems' => 3]);

custome settings in method first way (method)

$form->addSelectize('tags', 'štítky', $arrayData)->setValueField('slug')->delimiter('_');

Output is:

Select mode

dump($form->values->tags); // return "1"

Full mode

In full mode it will return array with valueField values. If you create some new tag, it will in sub array with plain text.

array (3)
	0 => "1"
	1 => "2"
	new => array (1)
		0 => "Third item"

Disabled items

In full mode it support disabled items at droplist

array (2)
    0 => array (3)
        'id' => 1
        'name' => "foo"
        'enabled' => true 
    1 => array (3)
        'id' => 2
        'name' => "bar"
        'enabled' => false 

统计信息

  • 总下载量: 9.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 14
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2020-08-21