Skip to content

Commit

Permalink
Fix for the select editor #7031
Browse files Browse the repository at this point in the history
  • Loading branch information
wszymanski committed Jul 23, 2020
1 parent ff2d235 commit 6e69fba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/editors/selectEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class SelectEditor extends BaseEditor {
* @private
*/
refreshValue() {
const sourceData = this.hot.getSourceDataAtCell(this.row, this.prop);
const physicalRow = this.hot.toPhysicalRow(this.row);
const sourceData = this.hot.getSourceDataAtCell(physicalRow, this.prop);
this.originalValue = sourceData;

this.setValue(sourceData);
Expand Down
23 changes: 23 additions & 0 deletions test/e2e/editors/selectEditor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,29 @@ describe('SelectEditor', () => {
expect(window.getComputedStyle(editor, 'focus').getPropertyValue('outline-style')).toBe('none');
});

it('should render proper value after cell coords manipulation', () => {
const hot = handsontable({
data: [
['0, 0', '0, 1', '0, 2'],
['1, 0', '1, 1', '1, 3']
],
editor: 'select',
selectOptions: [
'0, 0', '0, 1', '0, 2',
'1, 0', '1, 1', '1, 3'
]
});

hot.rowIndexMapper.setIndexesSequence([1, 0]);
hot.columnIndexMapper.setIndexesSequence([2, 1, 0]);

selectCell(0, 0);
getActiveEditor().beginEditing();
getActiveEditor().refreshValue();

expect(getActiveEditor().originalValue).toEqual('1, 3');
});

it('should populate select with given options (array)', () => {
const options = [
'Misubishi', 'Chevrolet', 'Lamborgini'
Expand Down

0 comments on commit 6e69fba

Please sign in to comment.