Sie können mich buchen für:
Individuelle Schulungen für XPages, JavaScript und Appcelerator Titanium Software-Entwicklung für IBM XPages, Appcelerator Titanium (Mobile Apps iPhone, iPad, Android, Blackberry 10), Mobile Web und IBM Notes
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

Comments:
1) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Tim Tripcony 18.08.2009 14:06:52

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
Julian Buss 18.08.2009 14:12:47

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
Julian Buss 18.08.2009 14:13:09

"Trim"... phew... sorry, I meant "Tim" :-)

4) Calling XPage gurus: submit button to submit only ONE datasource instead of ALL datasources
Jeremy Hodge 18.08.2009 15:32:03

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
Jeremy Hodge 18.08.2009 16:15:04

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
Jozsef Lehocz 01.02.2012 16:26:17

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.

Add a comment
Subject:
   
Name:
Mail:
Web:
 
Comment:  (No HTML - URLs with leading http://)
 
remember me?   
You can hire me.
See my Linkedin profile for details.

Thanks for reading and have a nice time here!

Please note my Apps for iPhone and iPad: NotesBook: takes your Lotus Notes Notebook (Journal) to your iPhone and iPad xpageswiki.com: huge XPages Tips & Tricks collection for iPhone and iPad