jhhb01/silverstripe_ajax_dropdown
Composer 安装命令:
composer require jhhb01/silverstripe_ajax_dropdown
包简介
Use Ajax in Dropdowns for large datasets
关键字:
README 文档
README
An silverstripe dropdown which loads results via ajax to handle large datasets
Example usage (I'll document this better later)
// Define a callback to load the results, don't worry about pagination of limiting here $dataSource = function ($term = null) { return SomeDataObject::get()->filter(['Title:PartialMatch' => $term]); }; // Here ID and Title are optional as they are the defaults, they are the names of the columns to // pull the ID and Text of the dropdown option from $field = AjaxDropdownField::create('LabelID', 'Label', 'ID', 'Title'); // This is the only required function call, of course feel free to just chain this on after ::create(...) $field->setSource($dataSource); // These methods are totally optional, I'm going to call them with their defaults below $field->setIDColumn('ID'); // Set the name of the column to pull the dropdown options ID from $field->setTextColumn('Title'); // Set the name of the column to pull the dropdown options text from $field->setMinLength(1); // Set the number of characters that must be entered before a search will be performed $field->setPageLength(150); // Set the number of results that will be returned on each search or "load more" // Each of the above methods also has an associated "getter" e.g. $field->getPageLength();
Other Methods
This field extends DropdownField so any methods you can call on there e.g. setEmptyString() will also work here.
Other Modules
This field should work with most other modules, I have explicitly tested this with sheadawson/silverstripe-quickaddnew
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-04-29