IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
20130913
sahi - how to access a specific table cell using regex when the cell doesn't have an id
here's some relevant, rendered HTML from a richfaces rich:dataTable for the image above:
...
<tbody id="invFormremoveTRQPanel:removeTrqPnlTbl:tb">
<tr class="rich-table-row rich-table-firstrow row1">
<td id="invFormremoveTRQPanel:removeTrqPnlTbl:0:j_id159" class="rich-table-cell wsS ">
<input type="checkbox" name="invFormremoveTRQPanel:removeTrqPnlTbl:0:j_id161"></input>
</td>
<td id="invFormremoveTRQPanel:removeTrqPnlTbl:0:j_id162" class="rich-table-cell wsS ">
X_TRQ_13144907
</td>
...
the green code represents the first row's second column. the red code is a random id string generated by richfaces because in the xhtml/jsf file, there was no id set for the cell:
...
<rich:column>
<f:facet name="header">#{msg['label.rcvrRefId']}</f:facet>
<h:outputText value="#{trq.getRcvrRefId()}" />
</rich:column>
...
here's one way to access the element using regexp:
_cell(/invFormremoveTRQPanel:removeTrqPnlTbl:0:*/+"[1]")
invFormremoveTRQPanel:removeTrqPnlTbl:0 == the row identifier
/.../ == regular expression code
* == match any auto-generated id string, e.g. j_id162, this will match every column in the first row
so to specify which column (0-based) we want we write [1]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment