0
votes

Okay... this is a little difficult to explain but I will try my best.

In Custom Control while adding properties in Property Definition we can set "Allow multiple instances" which allows us to add multiple instances of that property when the control is embedded in XPage.

Similarly, I need to know whether it is possible to add (and remove) Editable Areas in a custom control when it is embedded in XPage? What I plan is that I would have a repeat control inside my custom control and I would be able to put the contents in each editable area in every loop of that repeat.

Is this the right way to go about or am I looking at this problem incorrectly? Any solution not involving editable areas is also welcome :)

Update 4 Apr 2013:

A use case context I am looking for is a simple carousel where contents of each screen in carousel can have different contents. These contents would be put into each (dynamically added) editable area. The contents can be very different from each other with one screen containing only text, other only image and another both image and text.

1
Some use case context would be useful in determining a helpful answer for this: if this works, what does the user think they're doing?Tim Tripcony
We have an application in which a repeat control is used to allow the user to add multiple line items to a requisition. There are a number of edit boxes and other fields within the repeat, so that the user can identify the item, quantity, price and so on. They can click a link to add a new line item, which will be saved onto a new line item document and start appearing in the repeat. You can have more than one of them open to edit on the screen at once. So, yes, I think what you're asking to do is possible.David Navarre
@TimTripcony: I have updated my question.Naveen
@DavidNavarre: What I am looking for is slightly more complicated. The contents of repeat would different from each other and defined by developer. I have updated my question.Naveen
The repeat containing single control with multiple editable areas won't solve your use case - it would just clone all its content - what is not what you need, I suppose. I would suggest to make universal carousel based on multi param defining name of custom control to embed. You can dynamically add desired control one by one into component tree by quite simple Java code.Frantisek Kossuth

1 Answers

0
votes

Look at the table walker example in the 26 original exercises. It does mostly what you are looking for (conceptually). You won't need multiple editable areas. Whatever is inside the repeat gets repeated. What you want to do is to give the control a custom property "boolean editMode" so you can render that one line to be edited - if that's the UI pattern you want to follow.

You also could consider a dojo table with Ajax which allows for a familiar spreadsheet UI