NeoTable: neoTableSetColumn and subRoutine to format the data - Forum

Forum Navigation
You need to log in to create posts and topics.

NeoTable: neoTableSetColumn and subRoutine to format the data

Hi to all,
with neoTableSetColumn we can format the column of a neoTable table also using controls on the values ​​of that specific column through a parameter that passes that value to the formatting function. Is there any way to format a column by checking the value of another column? That is, how can you access the value contained in another column to use it in the current column?

Greetings
Rocco

Hi @roccocogliano

Not sure if it's possible, but you can try neoTableGetData and / or neoTableGetRowData from the formatting subroutine.
Let me know if it works.

Regards.

roccocogliano has reacted to this post.
roccocogliano

Hi @luishp,
I did some testing and finally found that if in the subroutine for formatting the column we declare the use of other parameters as below:
- 1nd parameter: "fieldName": the name of the field (STRING type parameter for the column)
- 2nd parameter: "jsonObject": a VARREF type parameter
- 3rd parameter: "idxObject": an INTEGER type parameter.
Names can be any.

By default the first parameter will be the column name, the second will automatically contain the current jSon object and the third will automatically contain the index of the current json object.

So with this information I think we can do whatever we want to format the column also based on the values ​​of the other columns

I hope I was clear and that it will be useful to others as well.

Greetings
Rocco

luishp has reacted to this post.
luishp

@roccocogliano Great! Thanks for sharing!
neoTable plugin was quite hard to develop, but I think it's really awesome.
It never stops surprising me and I use it quite often with neoPhp.

Best regards.

roccocogliano has reacted to this post.
roccocogliano