create a subclass of defaultdatatable, override newrowitem to be like this:

component newrowitem(...) {
  return new clickableitem(...) { onclick() { // implement onclick } }
}

class clickableitem extends item implements iclicklistener {
  oncomponenttag(tag) {
          tag.put("onclick","window.location='"+urlfor(this,
iclicklistener.interface)+"';");
  }

  final void onLinkClicked() { onclick(); }
  abstract void onclick();
}

-igor

On 10/22/07, Chris Ainsley <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm new to Wicket but can see in principle that it is a very good approach
> to the clean seperation between the presentation layer and the
> model/controller layer. That said, I'm having a hard time.
>
> I wish to create a simple table that lists the contents of a table in the
> database. I have created my per-record PoJo using Ammentos as my lightweight
> persistance layer. The table is now displaying successfully, but I wish to
> add a per-row css-style change event + per-row link (if the user clicks
> anywhere in the <tr> area, I wish to be redirected to a link corresponding
> to the ID of the current row (assuming a field called keyId in my PoJo
> per-row model).
>
> Here is a snippet of sample code:
>
>
> MyPanel.java
>
> public class MyPanel extends Panel {
>         public MyPanel () {
>                 List<IColumn> columns = new ArrayList<IColumn> ();
>
>                 // add my columns to the column list
>
>                 // i implemented this fine
>                 SortableDataProvider sortableDataProvider = 
> getDataModel(status);
>
>                 _dataTable = new DefaultDataTable("bondTable", columns,
> sortableDataProvider, 100);
>                 add(_dataTable);
>         }
> }
>
>
> MyPanel.html
>
> <wicket:panel>
>                 <table class="tablestyle1" cellspacing="0" 
> wicket:id="myTable">
>                         My Table Table
>                 </table>
> </wicket:panel>
>
>
>
> Please can anyone give me the correct approach or tell me if this is not
> possible with the DefaultDataTable component. Its very hard to know what is
> possible and what is not possible in Wicket due to lack of detailed user
> manual. I am currently using version 1.2.6.
>
> If anyone can help then I will be extremely grateful.
>
> Thanks,
>
> Chris.
> --
> View this message in context: 
> http://www.nabble.com/Newbie-question---how-to-create-a-Default-Data-Table-with-onmouseover-row-style-changes-%2B-link-per-row-tf4675145.html#a13357267
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to