Ahh, that makes sense. I'll give that a try tomorrow. Thanks! Tauren
On 4/30/07, Matej Knopp <[EMAIL PROTECTED]> wrote: > Safest solution is to do > item.setOutputMarkupId(true);; > > and then > target.appendJavascript("selectRow(document.getElementById('"+item.getMarkuipId()+"')"); > > -Matej > > On 4/29/07, Tauren Mills <[EMAIL PROTECTED]> wrote: > > Hi, > > > > It appears that the javascript "this" object is different when I > > hardcode the javascript into the html vs. using an AjaxEventBehavior > > and appendJavascript. For instance, the "this" in this refers to the > > TR which is correct and the selectRow functions works properly: > > > > <tr onClick="selectRow(this)" wicket:id="referees"> > > > > But if I use this html: > > > > <tr wicket:id="referees"> > > > > With this code in a DataView: > > > > item.add(new AjaxEventBehavior("onClick") { > > @Override > > protected void onEvent(AjaxRequestTarget target) { > > target.appendJavascript("selectRow(this)"); > > } > > }); > > > > Then my selectRow() method doesn't work right. It appears "this" is a > > different object and not the TR. > > > > For reference, here is the javascript, which just highlights the row > > that has been clicked and removes the highlight from the previously > > selected row, if any: > > > > var lastRow; > > var lastRowClass; > > > > function selectRow(row) { > > if (lastRow != null) { > > lastRow.className = lastRowClass; > > } > > lastRow = row; > > lastRowClass = row.className; > > row.className = "selected"; > > } > > > > Any ideas what the "this" object is in the 2nd case, and what I should > > use instead? > > > > Tauren > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user