Date format search results
The date format can be adapted to suit your needs, depending on tags and results.
To do this, simply define the JS function getSearchResultDateFormat
to return the desired date format.
The settings are as follows:
tagClassId
: tag class identifierresult
: the search result
An example of use:
function getSearchResultDateFormat(tagClassId, result){
if(tagClassId == "MonTagAModifier"){
return 'dd/MM/yyyyy';
}
return 'dd MM yyyy HH:mm';
}
Decorate your search results
You can decorate your search results: modifying the displayed value of a given field. To do this, simply define a decorator for the tag to be decorated.
In the following example, we define a decorator for the field fieldName
which will be called to resolve the value to be displayed for this field.
function decorate(fieldName){
var decorators = JSAPI.get().getHelperFactory().getSearchDecoratorsAPI();
decorators.register(fieldName, function(result, callback){
callback.onSuccess("decorated: " + result.getField(fieldName).getValue());
});
}
decorate("Personal number");
Formatting tag values
To display a tag, FlowerDocs formats its values:
- for dates, according to the defined format
- for value lists, according to defined labels
This mechanism can be used through the JS API, as shown in the following example:
var formatter = JSAPI.get().getHelperFactory().getFieldFormatter("DOCUMENT");
formatter.format(result.getField(fieldName), function(formattedValue){
console.log("Formatted value: " + formattedValue);
});