!!!I have made a correction in the above code - the if statement.
"product" is the data source of the panel inside repeater...
Sure you it can be done better way, but that is my way.
CheckBox Name: selectDoc
"Checked by default" formula:
var thisunid=product.getDocument().getUniversalID();
var selected=sessionScope.selectedDocs;
@If(@Contains(selected, thisunid), true, false);
Event on click:
var thisunid=product.getDocument().getUniversalID();
var selected=sessionScope.selectedDocs;
if (!sessionScope.selectedDocs==null){
var newval=@If(@Contains(selected, thisunid), @ReplaceSubstring(selected, thisunid,""),selected+"_"+thisunid);
}else{
newval = thisunid;}
sessionScope.selectedDocs=@Implode(@Trim(@Explode(newval,"_")),"_");