|
Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Julian Buss, August 18th, 2009 12:30:55
Tags: XPages
I had this problem in 8.5.0 some months ago, and now it popped up again. I tried everything I know, but failed so far.
Following situation: - one xpage - with three custom components - in each component there is a panel with a datasource of type "create document". The datasource is defined with the panel, not in the control. - inside the panel I have some fields and a "save" button So, the XPage contains THREE document datasources, all of them with the action "create document". But all datasources are defined in DIFFERENT panels. And in every panel there is a save button. When I set the save buttons to type "button" with the action "save document", only the datasource inside the panel is being saved - that's fine. BUT after saving the datasource needs to repesent a NEW document, not the formlerly saved document. When I set the button to type "submit", it saves the datasources and then creates a new document, just as I want. But then ALL datasources are saved. I played with partial refreshes and partial exection mode without luck. A submit button always seems to submit all sources. So, what I need is either a) a solution for submitting only ONE datasource or b) a solution to have a button of type "button" which saves a datasources and creates a new document after that (like a submit button) Who can help?
Comments (6) | Permanent Link
1) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Julian, I assume you're passing the data source into the control via a defined property? If so, you can call save() directly on the data source instance via SSJS, for example: compositeData.thisDataSource.save(); That should cause only that instance to save when the button is clicked. 2) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Trim, no, the datasource is defined in the component itself, in the panel properties. But even with your suggestion, I assume .save() will only SAVE the datasource, and will not create a NEW document for this datasource after that. And that exactly is the problem. To provide some context: it's for the comment functionality in our ServiceCommunicator: on the feedback XPage I have three components with datasources: a) a component for "create new feedback" b) a component for "create new reply to a feedback" c) a component for "create a comment to a reply" So when for example the user created a reply and hit the save button, I need to save the reply and then to clear the form so that the next time the button is pressed, a new reply is created. And that WITHOUT reloading the whole page! 3) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
"Trim"... phew... sorry, I meant "Tim" :-) 4) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Hey Julian ... Just had to create a similar scenario ... There is a trick to it. In the All Properties of the Panel that has the data source, expand "Data" twistie, then the next data twistie, then the "dominoDocument" twistie, then change the Scope to "request" ... The Save() will then actually work like this, when you submit, the save will create a new document...The values the user entered will be persistent however, so you will need to manually clear them. I put together a quick sample to show you ... download it here: { Link } 5) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
I put together a more detailed explanation over at the xpages blog as well : { Link } 6) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
I have downloaded the app of Jeremy. I have made a small modification: documents can be opened from the views in edit mode. After opening a document it is not possible to create a new document. Every change and save modifies the opened document, instead of creating new one. In addition I created a computed field for each region to display the current document noteid: var doc1:NotesDocument=document1.getDocument(); doc1.isNewNote()?"-":doc1.getNoteID(); However when I open a document the noteid is displayed in every section, not just in the selected one. Are these features bugs, or I just made something wrong?? Thank you for any suggestion. |
