The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20140321

[SOLVED] sahi, primefaces: p:dataTable no rendered table tag id

i'm updating our sahi test scripts for our new primefaces frontend and ran into a difficulty when trying to select a specific table row cell.

this page gives a hint as to how to select specific table cells:
http://sahi.co.in/docs/faq/get-cell-data.html

using this format:
_cell(_table("<table_identifier>"), x-1, y-1)


but the problem is that when a primefaces p:dataTable gets rendered to HTML, the table is enclosed in a div tag, and that div tag gets the id value set in the p:dataTable code, and the actual table tag doesn't have an id.

i solved my problem like this:
_cell(_table(1, _in(_div("selectMember:selectMemberTable"))), 1, 1)

here i specify the *second* table (there's a table in the header too), which is the actual dataTable table (0-based indexing, so value "1").

however, from what i can see, the sahi documentation is confusing concerning "x" and "y", if you interpret "x" to mean column (left<->right position), like i do.

"...1, 1)", in reality, means "row 2 (x), column 2 (y)" (0-based indexing, so "1, 1")

------------

as a side note, i found this sahi script code useful/interesting too:
_table(0, _in(_div("selectMember:selectMemberTable"))).rows[0].style='background-color:red'

which changes the background color of the first row of the first table to red.

No comments:

Post a Comment