{ result.Title }
{ result.Description }
{ result.Description }
Cannot find anything related to '{ keyword }'. Try a different search or contact us
We've already seen how the Request Context, Datasources and View Templates work together. Out of the box we can see they're quite powerful; but sometimes you need a little bit more juice.
That's why Expression comes with Javascript baked into the server.
Remember those Null Adapters? Let's look at an example:
{
"type" : "XprNullAdapter",
"contextName" : "RandomNumber",
"outputProcessors" : [ "ScriptsBundle/SampleScript" ]
}
outputProcessors is a key available to all adapter types. It supplies an array of bundlePaths to scripts which process the data in a filter chain:
Datasource-> (OutputProcessors...) -> ViewTemplate
Let's look at our theoretical ScriptsBundle/SampleScript:
function process(inputData) {
//inputData is null, our Datasource doesn't fetch anything
return {
"Value" : Math.random().toString
};
}
The downstream View Template can now use {{RandomNumber.Value}}
. Of course, this is just a toy example. Once you're familiarized with the functionality provided by the XPR Standard Library, you'll see how this powerful serverside scripts can really be.