javascript - Refresh to repeat control not working normal after deleting 1 row -


i have field named "selectedtime" in document, fields stores selected timings added user.adding times working perfect.this back-end.

now explain issue of selecting date front end.i have given button add add times.the custom control of date-time gets added repeat control on click of add button.even if check in document shows list of selected times.even works fine.

now if want delete selected time repeat control randomly, deleted particular record document, on page last record of repeat gets disappears,

i assuming issue partial refresh of repeat control,i have tried no result.full refresh breaks page.

java script code delete button

`var doc:notesdocument = database.getdocumentbyunid(context.geturlparameter("refid")) var selectedtimes:java.util.vector = doc.getitemvalue("selectedtimes"); if(selectedtimes != null){ var sdtstring =  getcomponent("inputhidden1").getvalue(); if(selectedtimes.contains(sdtstring)) selectedtimes.remove(sdtstring); doc.replaceitemvalue("selectedtimes",selectedtimes); doc.save(); }; var url:xspurl = context.geturl(); view.postscript("window.refresh('"+url+"')");` 

i know difficult understand want explain suggestion on appreciated.

even if have idea delete field values of documents,in case field name "selectedtimes" , values added times in repeat control, please share.

edit 1:

//repeat control  var doc:notesdocument = database.getdocumentbyunid(context.geturlparameter("refid")) var selectedtimes:java.util.vector = doc.getitemvalue("selectedtimes"); return selectedtimes; 

another try link repeat viewscope instead of document:

1) in event beforeloadpage/afterloadpage: value document, , put in viewscope variable:

// beforeloadpage event: // ... doc viewscope.selectedtimes = doc.getitemvalue("selectedtimes"); 

2) in repeat control, use viewscope:

<xp:repeat value="#{viewscope.selectedtimes}"... 

3) when update done, update both viewscope , document:

//...update view scope variable , document: doc.replaceitemvalue("selectedtimes", viewscope.selectedtimes); 

this hint if document added datasource:

do have document included in xpage datasource? in case, try , update notesxspdocument instead of document db:

xpage:

<xp:this.data>     <xp:dominodocument var="xspdocument"         action="editdocument"         documentid="#{param.unid}">     </xp:dominodocument> </xp:this.data> 

ssjs code: work directly xspdocument

var selectedtimes:java.util.vector = xspdocument.getitemvalue("selectedtimes"); ... xspdocument.replaceitemvalue("selectedtimes", selectedtimes); 

this hint if value not removed document:

in sdtstring getting string value:

var sdtstring =  getcomponent("inputhidden1").getvalue(); 

if have time values stored notesdatetimes, type of value inside vector , remove method won't find string , nothing removed.

// in vector<notesdatetime> string cannot found: selectedtimes.remove(sdtstring); 

be sure remove same type of value in vector


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -