Is there any way to modify the results (that is, the caption) displayed by the loupe component of gvNIX?
I create the loupe component with the following commands:
web mvc loupe setup
web mvc loupe set --controller ~.web.PersonController
web mvc loupe field --controller ~.web.PersonController --field personAddress --additionalFields address,code,town --caption address
With this, the component displays addresses as results (property address). How I can display also the ZIP code (property code) separated by a slash of the address? Something like this:
Address 1 - 47562
Address 2 - 57520
Address 3 - 8213P
View more...
To make that possible, you need to implement your own javascript function and set as attribute on loupe field.
On your jspx view, add "onDrawFunction" property to your loupe field with a function name like "onDrawPersonAddress".
Open the generated file "src/main/webapp/scripts/loupefield/loupe-callbacks.js" and implement onDrawPersonAddress function like the following
.
function onDrawPersonAddress(oData){
return oData.address + " - " + oData.code;
}
With that simple steps you can modify what is displayed on your loupe results.
You can return an HTML structure too.
If you need more info about loupe field you can check gvNIX Manual or quickstart app Guide:
https://github.com/DISID/gvnix-samples/tree/master/quickstart-app#loupe-fields
Best Regards,