Search code examples
xpagescontrolsrepeatdelete-row

Trying to delete the selected item in the XPages repeat control, but does not work


I am trying to delete the selected item in the Xpages repeat control, but it does not work. Please help? Here is my code in the repeat control section

<xp:repeat id="repeat1" rows="30" var="eachQuestion" value="#{questions}"
                indexVar="rowIndex">
<tr>
 <td>...</td>
 <td>  <xp:link     styleClass="btn btn-danger" id="deleteLink">
    <xp:eventHandler event="onClick"
        action="#{javascript:eachQuestion.getDocument().remove(true);}"
        submit="true"
        refreshMode="partial"
        refreshId="listContainer" />
        <i class="fa fa-lg fa-trash-o" />
    </xp:link> </td>
</tr>
</xp:repeat>

Here is what I can see in the client page, generated html and JS code:

XSP.addOnLoad(function() {
XSP.attachPartial("view:_id1:repeat1:0:_id44","view:_id1:repeat1:0:deleteLink", null, "onClick", function(){}, 2, "view:_id1:listContainer");

When I click the delete link icon, nothing happened. I realized function(){} nothing in there. Is there anything wrong or I have to implement the method in the Java code to handle this deletion?

Thanks,


Solution

  • You just have to change "onClick" to "onclick" in your code and it will work.

    Case sensitivity does matter in Xpages. So, your code to delete a document is right but the event "onClick" doesn't gets executed at all.