Is the omniJS interface to non-topic cells complete at this stage ?
I am finding it a little hard to read the Object data returned, and I wonder whether it would be helpful to add a cell.valueString method, returning a default stringification of the value, for the non topic cells ?
It looks as if we need to branch on conditionals like if (col.type === Column.Type.Text) before knowing how to read the contents of a value returned by item.valueForColumn(col), but even then I find that I am failing so far, to read the data corrrectly.
For example, I had assumed that values returned by item.valueForColumn(col) in columns which return ‘true’ for (col.type === Column.Type.Text) would be instances of the Text class, but I find that they are returning undefined for the Text.string property which I see in the documentation.
Perhaps a snippet showing best practice in reading data out of non-topic cells would be helpful ?
Or perhaps that interface is not quite ready yet ?
So far I am getting only as far as reading values which have a default string version:
{
"text": "Candide, ou l’Optimisme",
"nest": [],
"Title": {},
"Author": {},
"Year": 1759,
"Origin": {},
"Owned": {},
"Read": {},
"Started": "2013-01-14T08:00:00.000Z",
"Finished": "2013-01-21T08:00:00.000Z",
"My Rating": {}
}
by using code like:
// jsoOutline :: OO.item -> Node {text:String, nest:[Node]}
var jsoOutline = item =>
Object.assign({
text: item.topic,
nest: item.children.map(jsoOutline)
}, (() => {
let dct = {};
cols.forEach(col => {
dct[col.title] = item.valueForColumn(col);
});
return dct;
})());
but I am not managing to read even Text values with code like:
var cellString = (col, item) => {
const type = col.type;
return (type === Column.Type.Text) ? item.valueForColumn(col).string : 'not Text';
}
( .string is reported to be undefined, though it appears to be listed in the documentation of Text instances)