当前位置: 动力学知识库 > 问答 > 编程问答 >

spring roo - How to modify the results displayed by the loupe component of gvNIX

问题描述:

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.

  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,

分享给朋友:
您可能感兴趣的文章:
随机阅读: