Monday, October 28, 2013

Working with Property Definition in Custom Controls - Xpages

I found a nice lesson about this in Xpages 101. Hola, my innernet connection was awesome, that I was not able to view the video through the vimeo player. With a bit of research, I was able to figure it out and thus this fine article :P

I dont remember using this or seeing this in 8.5 or 8.5.1. And now I see that this is very useful and can be used in a lot of ways. To me this feature really does make more sense to the existence or employment of custom controls in designs. As a matter of fact, I think I should start sticking with Custom controls and use Xpages only to resuse my custom control. Dont O.o me if you think other wise. May be I am just curious

Jumping right on to the topic, try the following and you may understand how it works.

1. As always, You must start with creating or using an existing custom control. Open it and go to the properties pane.

2. Now add a property to the custom control as illustrated in the following screen shot. In addition you can go to the validation and visible tabs and code your way as per your necessity

3. Now include this custom control in some XPage and click on the custom control. You will find a tab called as "Custom Properties" when you select the included custom control. You can infer what I see in my case. I see the property that I created and I am able to assign a value to it

4. The little diamond symbol beside the custom property value says I can do stuffs like link it with a scoped variable or some thing :). Think you get the idea

5. Now to see how to provide and retrieve the value for/from the custom property, create a computed field in your custom control and look for compositeData. You can find your property name and use it as per your requirement.

There you go. Hope this helps :)

No comments:

Post a Comment