开发者

XForms: Delete trigger in table row (repeat)

开发者 https://www.devze.com 2023-03-31 18:42 出处:网络
I am using an XForms\' repeat to build up a table (very similar to http://wiki.orbeon.com/forms/doc/developer-guide/xforms-repeat). Each row should get a delete trigger to remove it. The following cod

I am using an XForms' repeat to build up a table (very similar to http://wiki.orbeon.com/forms/doc/developer-guide/xforms-repeat). Each row should get a delete trigger to remove it. The following code does only delete the selected item, is it so开发者_C百科mehow possible to use the current repeat index as a value for at?

<xforms:delete nodeset="employees" at="index('employee-repeat')"/>

Thank you for your help!


If you have a delete trigger for every row, then you don't need to use the index() function. Instead, just refer to the current node, as in:

<xforms:repeat nodeset="employees">
    ...
    <xforms:trigger>
        <xforms:label>Delete</xforms:label>
        <xforms:delete ev:event="DOMActivate" nodeset="."/>
    </xforms:trigger>
</xforms:repeat>

If you had just one trigger for the whole repeat (i.e. at the beginning and/or end of the table listing the employees), then you could use index() to refer to the "current" employee. That means that users would first need to click somewhere on that employee to make it the current one, and then click on the button. This is a somewhat unusual web UI, and so I would rather have one delete button per employee or use checkboxes for users to select which employees they want to act on.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号