When you run the HOT-in-HOT demo, when you click on a cell other than the one you select.
‘getValue’ will be executed again.
in trouble. Is this a bug?
I am sorry that I am not good at English.
var
carData = getCarData(),
container = document.getElementById(‘example1’),
manufacturerData,
colors,
color,
colorData = [],
hot;
manufacturerData = [
{name: ‘BMW’, country: ‘Germany’, owner: ‘Bayerische Motoren Werke AG’},
{name: ‘Chrysler’, country: ‘USA’, owner: ‘Chrysler Group LLC’},
{name: ‘Nissan’, country: ‘Japan’, owner: ‘Nissan Motor Company Ltd’},
{name: ‘Suzuki’, country: ‘Japan’, owner: ‘Suzuki Motor Corporation’},
{name: ‘Toyota’, country: ‘Japan’, owner: ‘Toyota Motor Corporation’},
{name: ‘Volvo’, country: ‘Sweden’, owner: ‘Zhejiang Geely Holding Group’}
];
colors = [‘yellow’, ‘red’, ‘orange’, ‘green’, ‘blue’, ‘gray’, ‘black’, ‘white’];
while (color = colors.shift()) {
colorData.push([
[color]
]);
}
hot = new Handsontable(container, {
data: carData,
colHeaders: [‘Car’, ‘Year’, ‘Chassis color’, ‘Bumper color’],
columns: [
{
type: ‘handsontable’,
handsontable: {
colHeaders: [‘Marque’, ‘Country’, ‘Parent company’],
autoColumnSize: true,
data: manufacturerData,
getValue: function() {
var selection = this.getSelectedLast();
console.log(1);
// Get always manufacture name of clicked row
return this.getSourceDataAtRow(selection[0]).name;
},
}
},
{type: ‘numeric’},
{
type: ‘handsontable’,
handsontable: {
colHeaders: false,
data: colorData
}
},
{
type: ‘handsontable’,
handsontable: {
colHeaders: false,
data: colorData
}
}
]
});