01-16-2014 09:26 AM
Hello,
In Nuxeo 5.8 try to use the single document suggestion widget with inline javascript.
Document schema are set to "dublincore" and also my custom schema. Nevertheless this value are not used by inline javascript because I can just see "title" and "path" as results.
function myFormatter(entry) {
var markup = entry.title + " " + entry.description + " " + entry.mycustom + " " + entry.path;
return markup;
}
Here, entry.description and all dublincore fields such as author failed... entry.mycustom failed too. But this fields exists on the document(s) suggested ant selected...
Why ? Is my code wrong ?
thanks
01-16-2014 11:32 AM
Hello me,
First I did Json neewbie investigations :
function myFormatter(entry) {
var markup = JSON.stringify(entry);
return markup;
}
This method show ALL the properties that exist in the objet of work named "entry".
In the properties it looks like that xpath value are not such as default value.
Default values are: entity-type, type, state, versionLabel, title, lastModified, path, isCheckedOut,repository,uid...
And then comes "properties" that is hashMap Json. Here a function to read a special tab in entry.properties and also show a classic propertie "path"
function myFormatter(entry) {
var markup = entry.title + " simple acces " + entry.properties["dc:description"] + " test json " + readJSONTab(readJSONTab(entry,"properties"),"dc:description") ";
return markup;
}
//Test Json
function readJSONTab(data,tagExtracted){
var json = JSON.parse(JSON.stringify(data))
return json[tagExtracted];
}
PS : To use other kind of xpath properties, have fun with this start and use JSON javascript function
PS 2 : http://msdn.microsoft.com/fr-fr/library/ie/cc836466(v=vs.94).aspx JSON.parse need a character chain NOT an objet. So, use JSON.stringify on your objects first.
01-16-2014 11:32 AM
Hello me,
First I did Json neewbie investigations :
function myFormatter(entry) {
var markup = JSON.stringify(entry);
return markup;
}
This method show ALL the properties that exist in the objet of work named "entry".
In the properties it looks like that xpath value are not such as default value.
Default values are: entity-type, type, state, versionLabel, title, lastModified, path, isCheckedOut,repository,uid...
And then comes "properties" that is hashMap Json. Here a function to read a special tab in entry.properties and also show a classic propertie "path"
function myFormatter(entry) {
var markup = entry.title + " simple acces " + entry.properties["dc:description"] + " test json " + readJSONTab(readJSONTab(entry,"properties"),"dc:description") ";
return markup;
}
//Test Json
function readJSONTab(data,tagExtracted){
var json = JSON.parse(JSON.stringify(data))
return json[tagExtracted];
}
PS : To use other kind of xpath properties, have fun with this start and use JSON javascript function
PS 2 : http://msdn.microsoft.com/fr-fr/library/ie/cc836466(v=vs.94).aspx JSON.parse need a character chain NOT an objet. So, use JSON.stringify on your objects first.
01-20-2014 02:38 PM
Yes, you got it. Any schema properties can simply be accessed via entry.properties["xx
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.