我正在尝试扩展handsontable插件以支持其下拉列表中的多个选择.我已经尝试通过按照建议https://github.com/trebuchetty/Handsontable-select2-editor/issues/7修改'dropdownEditor'来扩展内置到库中的基本编辑器 .我花了几个小时阅读和搜索关键字的来源,但我没有想出任何真正的用途.
我不介意使用Angular扩展或其他原生ECMA5或扩展https://github.com/handsontable/handsontable插件的方式来解决这个问题.
到目前为止,我唯一的想法是使用这些代码按照存在的模式实际扩展框架.我在下面添加了指向的所有LOC:multiselect或者Handsontable.MultiselectDropdownCell复制了dropdown方法,称为新名称,一切正常,但仍无法看到我可以在哪里开始找到我要找的东西.
Handsontable.MultiselectDropdownCell = {
editor: getEditorConstructor('multiselectdropdown'),
renderer: getRenderer('autocomplete')
};
Handsontable.cellTypes = {
text: Handsontable.TextCell,
date: Handsontable.DateCell,
numeric: Handsontable.NumericCell,
checkbox: Handsontable.CheckboxCell,
autocomplete: Handsontable.AutocompleteCell,
handsontable: Handsontable.HandsontableCell,
password: Handsontable.PasswordCell,
dropdown: Handsontable.DropdownCell,
multiselect: Handsontable.MultiselectDropdownCell
};
Handsontable.cellLookup = { validator: {
numeric: Handsontable.NumericValidator,
autocomplete: Handsontable.AutocompleteValidator
}};
Run Code Online (Sandbox Code Playgroud)
我有一个修改版的下拉编辑器,它看起来像:
import {getEditor, registerEditor} from './../editors.js';
import {AutocompleteEditor} from './autocompleteEditor.js';
/**
* @private
* @editor MultiSelectDropdownEditor
* @class MultiSelectDropdownEditor
* @dependencies AutocompleteEditor
*/
class MultiSelectDropdownEditor extends …Run Code Online (Sandbox Code Playgroud) javascript multi-select angularjs handsontable drop-down-menu