@quantlab/handsontable
Version:
Spreadsheet-like data grid editor that provides copy/paste functionality compatible with Excel/Google Docs
30 lines (25 loc) • 829 B
JavaScript
import AutocompleteEditor from './autocompleteEditor';
import Hooks from './../pluginHooks';
/**
* @private
* @editor DropdownEditor
* @class DropdownEditor
* @dependencies AutocompleteEditor
*/
class DropdownEditor extends AutocompleteEditor {
prepare(row, col, prop, td, originalValue, cellProperties) {
super.prepare(row, col, prop, td, originalValue, cellProperties);
this.cellProperties.filter = false;
this.cellProperties.strict = true;
}
}
Hooks.getSingleton().add('beforeValidate', function(value, row, col, source) {
let cellMeta = this.getCellMeta(row, this.propToCol(col));
if (cellMeta.editor === DropdownEditor) {
if (cellMeta.strict === void 0) {
cellMeta.filter = false;
cellMeta.strict = true;
}
}
});
export default DropdownEditor;