xforms:setindexAdded by IBM on August 8, 2013 | Version 1 (Original)
|Sets the index for the xforms:repeat element in a table. This determines which row in the table receives the focus.
Rows use one-based indexing. This means that the first row has an index of 1, the second and index of 2, and so on.
Table 1. setindex parameters
<xforms:setindex event repeat="ID" index="index"/>
<xforms:setindex repeat="ID" index="index"/>
|event||string||the XForms event that triggers the action.|
|id||string|| the ID of the <xforms:repeat> element for which you want to set the index. |
|index||XPath||the number to set the index to.|
Example The following button deletes a row from a table:
The third action performed by this button is an xforms:setindex. In this case, xforms:setindex ensures that the index is always focused on the last row of the table and unless the row to be deleted is selected by the user.
<xforms:setindex index="index" repeat="orderTable"/>
- You can use xforms:setindex to set the index of a repeat that is nested in another repeat. In this case, the row index of the outer repeat determines which inner repeat is set.
For example, consider a case in which repeat X contains repeat Y. Repeat X has an index of 2, and repeat Y has an index of 5. You set repeat Y to an index of 3. To locate the correct repeat, we first go to row two of repeat X, then find repeat Y within that row.