How to get the data from a custom propertie that is in a group on an custom control on an Xpage?

StackOverflow https://stackoverflow.com/questions/9314549

문제

I'm working on a custom control that has custom properties.

If I want to use the value of a property it is very easy. For the value of the property "maptype" I can use compositeData.maptype But how do I do this wit groups?

For example I have a goup called "Marker" and there can be multiple of them. Each marker has five properties: "address", "title", "layer", "infotext" and "icon". How do I access for example the value of title on the third marker?

도움이 되었습니까?

해결책

the group of properties is interpreted as com.ibm.xsp.binding.PropertyMap java class. The multiple instances are interpreted as java.lang.ArrayList class. Knowing this I would try

compositeData.Marker[2].address

for simple data binding. Or

compositeData.Marker.get(2).get('address')

for accessing via pure javascript.

다른 팁

There are many ways to use it. It is just a collection with properties that you can iterate. One way could be to use it inside a repeat control. This is an example how you could use it:

            <xp:repeat id="repeat1" rows="30"
                value="#{javascript:compositeData.Marker}"
                var="rowMarker">

                <xp:label id="lbladdress"
                    value="#javascript:rowMarker.address}">
                </xp:label>
                <xp:label id="lbltitle"
                    value="#javascript:rowMarker.title}">
                </xp:label>

            </xp:repeat>

If you want to loop, you can just use: for(marker in compositeDate.Marker){ marker.title; }

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top