olicek/form-selectize
Composer 安装命令:
composer require olicek/form-selectize
包简介
Form extension for Nette framework
README 文档
README
Form extension for Nette framework
More documentations
- [javascript settings] (https://github.com/Olicek/form-selectize/blob/master/docs/en/javascript.md)
- [ajax] (https://github.com/Olicek/form-selectize/blob/master/docs/en/ajax.md)
Requirements
- Nette 2.2+
- jQuery 1.8+
- [Selectize] (https://github.com/brianreavis/selectize.js)
Installation
The best way to install olicek/form-selectize is using Composer:
$ composer require olicek/form-selectize
After installation server site, you have to install client site. The best way is use bower.
Link selectize.js from client-side and original selectize.js and call somewhere function selectize().
| NOTE: If you need use previous javascript, it is available in selectize-old.js
Last step is enable the extension using your neon config
extensions:
selectize: App\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"
olicek/form-selectize 适用场景与选型建议
olicek/form-selectize 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.11k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2014 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 olicek/form-selectize 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 olicek/form-selectize 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2014-10-08