dnadesign/silverstripe-advanceddropdowns

DropdownField 和 GroupedDropdownField,允许在每个选项标签上使用 data-attributes

安装数: 16,805

依赖项: 0

建议者: 0

安全性: 0

星标: 17

关注者: 13

分支: 3

开放性问题: 1

类型:silverstripe-vendormodule

2.0.3 2018-04-26 22:44 UTC

This package is auto-updated.

Last update: 2024-09-06 14:52:57 UTC


README

简介

DropdownField 和 GroupedDropdownField 允许在每个选项标签上使用 data-attributes。这对于第三方下拉样式非常有用,例如 (http://silviomoreto.github.io/bootstrap-select/),它们依赖于选项上的 data-attributes。

请注意,此模块仍在开发中,没有测试。

AdvandedDropdownField

按照以下方式设置 AdvandedDropdownField

new AdvancedDropdownField('AdvancedDropdown', 'DropdownField with option attributes', array(
	'value1' => array(
		'Title' => 'Option 1',
		'Attributes' => array(
			'data-myattribute' => 'This is an attribute value'
		)
	),
	'value2' => array(
		'Title' => 'Option 2',
		'Attributes' => array(
			'data-myattribute' => 'This is an attribute value'
			'data-myattribute2' => 'This is a second attribute value'
		)
	)
));

AdvandedGroupedDropdownField

按照以下方式设置 AdvandedGroupedDropdownField

new AdvancedGroupedDropdownField('AdvancedGroupedDropdown', 'Advanced grouped dropdown', array(
	'value1' => array(
		'Title' => 'Ungrouped option',
		'Attributes' => array(
			'data-myattribute' => 'This is an attribute value'
		)
	),
	'Option group 1' => array(
		'value2' => array(
			'Title' => 'Option 2',
			'Attributes' => array(
				'data-myattribute' => 'This is an attribute value'
			)
		),
		'value3' => array(
			'Title' => 'Option 3',
			'Attributes' => array(
				'data-myattribute' => 'This is an attribute value'
			)
		)
	),
	'Option group 2' => array(
		'value4' => array(
			'Title' => 'Option 4',
			'Attributes' => array(
				'data-myattribute' => 'This is an attribute value'
			)
		),
		'value5' => array(
			'Title' => 'Option 5',
			'Attributes' => array(
				'data-myattribute' => 'This is an attribute value'
				'data-myattribute2' => 'This is a second attribute value'
			)
		)
	)
));

维护者联系方式

* James ayers (james.ayers@dna.co.nz)

要求

  • SilverStripe 3.x

许可证

BSD-3-Clause. 请参阅 LICENSE。