问题
I am using Domino 9.0.1 and I am developing an XPage application to act as a time sheet. In an entry page, I have a repeater where I have one custom control repeated 10+ times. Each control has its own Java Object (stored in an ArrayList on the page) and its own NotesXspDocument data source. I am using a custom control in order to 1) maintain a constant look and feel throughout the entire application, 2) if changes need to be made to functionality or to design they should be made in one location and not multiple throughout the application 3) i feel that such object oriented styles is just best practice.
My issue is this. Each instance of the control can save itself. It has direct access to its dataSource (NotesXspDocument), and I have had no issues with such designs in the past. Because of the repeater, I want to be able to give the user the opportunity to click on one save button on the page, and then iterate through each custom control instance and tell it to save its datasource without making the user click on save 10 to 20 times. All of the searches that I have made for such a task only return giving a custom control access to a page's datasource, or for passing a function to the custom control and not giving an xpage access to an internally defined function.
Does anyone know if this is possible?
The other idea that I could play with is adding a DominoDocument to the background java class and then telling the Java class to save itself.
Any suggestions?
Thank you very much in advance for any advice and help!
Greg
回答1:
If you add a button of type "Submit" it will save all data sources at once.
来源:https://stackoverflow.com/questions/23389730/xpage-custom-controls-calling-an-action-defined-in-a-custom-controll