Search code examples
xpageslotus-dominoxpages-extlib

How to get marked rows in the XPages Extension Library <xe:dataView> design element?


I have a XPage with design element. How can I get list of checked rows to post it to an agent?

<xe:dataView id="dataView1" columnTitles="true"
    expandedDetail="true" var="dview1" 
    openDocAsReadonly="false" rows="15" showCheckbox="true"
    showHeaderCheckbox="true">

Thank you!


Solution

  • For the client-side, you can use Dojo. The following CSJS script will return NoteIds for all selected rows:

    dojo.query(".lotusFirstCell > input:checked").attr('value')
    

    For the server side, you can grab the IDs of selected documents by:

    var idList = getComponent("dataView1").getSelectedIds();
    

    This will return a string array of NoteIDs. Then pass it to an in-memory document and call the agent.

    var doc = database.createDocument();
    doc.replaceItemValue("IDList", IDList);
    
    var agent:NotesAgent=database.getAgent("SomeAgent");
    agent.runWithDocumentContext(doc);