Column's data picking

Tags: #<Tag:0x00007f8b28dc3880>

Hello.
Handsontable provides a way to specify what data pick for every column. And if I have an object in a data row I can provide path to needed data by data: "someObject.neededData", but if someObject in the data is null it raises an error

Is there any way to use data: "someObject.neededData" in cases when someObject can be null?
Way to reporduction: https://jsfiddle.net/lasteexile/enytfga2/1/ (the second data row)

Hi @bbriz020903

If your data is incomplete (you link to children object while some parents are null) then you can connect the column data to the parent (in this example name) and then use a custom renderer to extract first and second. But then if you allow users to edit the data you have to do the same in the cell editor. An alternative would only be to fill your name object with first: null, second: null before it’s loaded to Handsontable (and that should be programmatically easier to achieve).

Thank you for your reply, Aleksandra. I have another question about the theme. I can set a data property in a column as a function like here, but this way does not allow to set data(after entering any data a cell remains empty). Is it possible to use the function to read and set data at one time? And if it’s possible, could you please give me an example of this function.

And I’ve forgotten to notice that if the object is an empty string it’s working without an error, so it’s no need to fill the name object with first: null, second: null. Example. Does Handsontable have any method to change this behavior to not use custom renderers or filling the data and just work as if it is an empty string?

A function is not a supported type of data in columns at the moment. Definition: https://github.com/handsontable/handsontable/blob/6a1706061163b8d1f7752e54ef6f10efbc764b8b/handsontable/types/settings.d.ts#L72
Even if it works it was not tested and we cannot guarantee that it will work as expected.

Understood. Thank you for the reply

As there are no additional questions I’m closing the thread @bbriz020903
But feel free to open a new one when needed.