2

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...
skaffman
  • 398,947
  • 96
  • 818
  • 769
dcervera
  • 43
  • 5
  • 2
    Please use English here at StackOverflow. – Michael Sep 19 '14 at 16:20
  • Is it required to use english or any language can be used? – eruiz Sep 19 '14 at 17:05
  • 1
    Ok I read about that at help and it seems english is needed in order moderators be able to review the questions and answers. There is an open proposal to create a new site for Stack Overflow in spanish, vote for it at http://area51.stackexchange.com/proposals/42810 – eruiz Sep 20 '14 at 14:23

1 Answers1

3

To make that possible, you need to implement your own javascript function and set as attribute on loupe field.

  1. On your jspx view, add "onDrawFunction" property to your loupe field with a function name like "onDrawPersonAddress".

  2. 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,

jcgarcia
  • 3,762
  • 4
  • 18
  • 32