Welcome to the IBM Collaboration Solutions Community IQJam.
UsernamePassword
Reset Password | Register
   
Home | Leader Board | Tags | Help
Editing a Repeat Control 
Let's say that I have a repeat control that is showing documents in the normal "read" mode.  Now I want to have an edit button in the repeat which will let the user click on it and change the fields to editable and then display a save button.
 
Does anyone know if there are any existing examples for this? If now,  how would I approach this to get the desired effect?

Thanks!
Domino Development / XPages
David Leedy - over 2 years ago |  |  | Viewed 304 times

There are 3 answers

1votes
Hey David, I do this in Opa ... the way I found to do it that I liked best was to have a custom control that laid out the way I wanted in edit mode, then the edit button did a partial refresh to replace the line that was visible in "read" mode with the custom control ... the custom control was passed a UNID of the document you wanted to edit, and the save button there saved the update, then did another partial refresh, replacing the custom control with the "read" view again ... I used a viewScope'd hash variable to control the display of the components i wanted in edit mode (i.e. if the hash contained the UNID as a variable and it was 'true' then I'd display the custom control that would edit the document that I passed in a UNID to, otherwise I would display the 'read' only version of the line.  One tip, if you do it this way, when you are in read mode, and even though you set the custom control to not render via an <xc:this.render...>, modify the UNID to be blank that would normally get passed to the edit custom control ... it messes with unread marks if you dont (XPages bug) ... let me know if you need a code sample, I think I have one that I used to describe the aforementioned bug...


Jeremy Hodge - over 2 years ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community


0votes
I would suggest this approach:
- put panel inside repater
- put datasource inside repeater (chceck source). initialize it by UNID of document shown by repeater
- put edit/save buttons inside repeat
- in Save button use datasource.save() - avoid simple actions (they act on all or first DS)
- Edit button is a bit tricky - you can't use something like datasource.setEditable() - but there is workaround (http://www.juliusbuss.de/web/youatnotes/blog-jb.nsf/dx/xpages-how-to-set-edit-mode-via-javascript.htm?opendocument&comments comment #5)
- set both buttons to do partial refresh only of the first mentioned panel inside repeater


Frantisek Kossuth - over 2 years ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community


0votes
Hi Jeremy,
 
I'm facing exactly the same problem as David and tried to implement your solution but I didn't succeed.
You said that you had a sample code of this, can you give it to me, please?
Thanks in advance.
Ludovic 


Ludovic JEANSON - about 1 year ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community