get the unid of selected documents and save to scoped variable

后端 未结 3 1049
南笙
南笙 2021-01-27 23:23

I\'ve a viewPanel1 with checkboxes. By clicking on a button I would like to save the univ id\'s (comma seperated) of the selected items to a scoped variable. I tried this :

相关标签:
3条回答
  • 2021-01-27 23:54

    What you could do is the following

    var vPanel = getComponent("viewPanel");
    docIdArray = viewPanel.getSelectedIds();
    sessionScope.put("SelectedIds",@Implode(docIdArray,","));
    
    0 讨论(0)
  • 2021-01-28 00:05
    var viewPanel=getComponent("viewPanel1");
    var docIDArray=viewPanel.getSelectedIds();
    var unidArray = new Array();
    for(i=0; i < docIDArray.length; i++) {
       var unid=database.getDocumentByID(docIDArray[i]).getUniversalID();
       unidArray.push(unid);
    }
    sessionScope.put("test", @Implode(unidArray, ","));
    

    This will probably do it.

    0 讨论(0)
  • 2021-01-28 00:15

    Also, don't forget that scoped variables can hold an array, so you don't really need to box/unbox the array:

    sessionScope.put("SelectedIds", getComponent("viewPanel1").getSelectedIds());

    0 讨论(0)
提交回复
热议问题