HOT-in-HOT demo 'getValue' executed again

Tags: #<Tag:0x00007efc65719cc0>

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
}
}
]
});

Hi @mizuyami

What steps should I take to replicate the issue? I am using this demo http://jsfiddle.net/3pbct86o/

Thank you for reply.
I wrote ‘console.log(1)’ at the problem location

How to reproduce the problem

Open HOT-IN-HOT from the cars columns and choose any.
‘console.log(1)’ is executed.
Select other cells.
‘console.log(1)’ is executed again.

Ah, OK. The columns are called after each render. If you want the log to be called only for the first column you can add a condition to the 68’ line.

I do not want to run ’console.log(1)’ for the second time, but what condition should I do?
I tried it variously but it did not go well.

Sorry, it can be a little bit more complicated if you use the value key. I have asked my colleague to take a look at it.

In the meanwhile can you tell me what is is main goal? Maybe I’ll find another way that you can achieve it

Thank you for reply.
After that, as a result of trying your reply as a hint,
I found that it could be solved by using ‘afterSelectionEnd’ instead of ‘getValue’.
When choosing HOT-IN-HOT for the purpose,
It was to post the value of the selected row in HOT - IN - HOT to another cell.

getvalue
http://jsfiddle.net/udx9h5Lf/1/

afterSelectionEnd
http://jsfiddle.net/Lrdj84q2/6/

I will use JSFiddle for the first time, is this it?
It works, but is there any other good way to do it?

Hi @mizuyami

The afterSelectionEnd is usually a good choice if you want to track how and which cells user selects. But we also have a couple of callbacks that can help