Add a boolean flag to your POJO (domain model object type).
When you click the details link, set it to true and refresh the table.

When the table refreshes it will hit your DataProvider which will be in
charge of adding the new POJO with the description at the right location in
the list (after the one elements that have been marked with true) for the
current page. Then when the table renders, you would grab a hold of the
cell's TD element and set its "colspan" attribute to the number of the
columns and render the HTML you want in it (see how toolbars to the same
thing).

As an idea, you might need a second flag to represent the type of the row
(simplified or detailed) or use inheritance and store the type flag at the
parent class and your collection should hold children as returned via a
getRowContent() method.

~ Thank you,
  Paul Bors

-----Original Message-----
From: William Speirs [mailto:[email protected]] 
Sent: Wednesday, October 10, 2012 10:25 AM
To: [email protected]
Subject: Re: Dynamically Toggling a Details Row in a DataTable

Paul-

I've modified my DataProvider to provide double the rows. I've also extended
DataTable to set display: hidden on the details row and also to expand the
first column to all of the columns.

The main issue I'm having now is linking the button (in say the first
column) to something which can change the attributes of the cell. I guess my
main question is, what should control the stat of if a details row is hidden
or not?

Bill-

On Wed, Oct 10, 2012 at 2:20 AM, Martin Grigorov
<[email protected]>wrote:

> Hi,
>
> Check
> http://wicketinaction.com/2008/10/repainting-only-newly-created-repeat
> er-items-via-ajax/ This may give you an idea how to add/remove 
> additional rows with Ajax.
>
> On Tue, Oct 9, 2012 at 11:21 PM, Bill Speirs <[email protected]>
> wrote:
> > Paul-
> >
> > Thanks for the response... yea, we'd like to see another row below 
> > the current one, and in an single column. This way we can put 
> > whatever component/panel we'd like in that new row. Any suggestions 
> > on where to
> get
> > started? I feel as though I'm going to need to re-work (more than 
> > simply
> > extend) DataTable as I'll need to add additional rows.
> >
> > Thanks!
> >
> > Bill-
> >
> > On Tue, Oct 9, 2012 at 4:14 PM, Paul Bors <[email protected]> wrote:
> >
> >> Must it be in a separate row? It doesn't make much sense to have
> details in
> >> a separate row unless you want to show the same columns.
> >> And if you are going to show details for the same columns, then why 
> >> not just toggle each of the cell component between a simplified and 
> >> detailed
> view?
> >> I do it all the time when editing a table row, I toggle between 
> >> labels
> and
> >> form fields to set the contents of the table row.
> >>
> >> If you do want to show extra details that do not match the columns 
> >> in
> your
> >> table, use a pop-up or modal pop-up.
> >>
> >>
> >> ~ Thank you,
> >>   Paul Bors
> >>
> >> -----Original Message-----
> >> From: William Speirs [mailto:[email protected]]
> >> Sent: Tuesday, October 09, 2012 3:01 PM
> >> To: [email protected]
> >> Subject: Dynamically Toggling a Details Row in a DataTable
> >>
> >> I would like to create a component that generates an additional row 
> >> in a DataTable for each existing row. This additional row will 
> >> contain
> "details"
> >> for the above row. I would like to have a column in the DataTable 
> >> that contains a link/button/etc which controls the visibility (display:
> hidden
> >> for that row) of the details row. Inside the details row, the 
> >> colspan
> would
> >> be set to the # of columns and contain an AjaxLazyLoadPanel such 
> >> that
> when
> >> the row is displayed the getLazyLoadComponent() method is called, 
> >> generating and fetching the proper component.
> >>
> >> So the DataTable will look like a normal DataTable, except when you
> click
> >> the link/button/etc a new row is shown and displays the Component
> returned
> >> from the call to the getLazyLoadComponent() method.
> >>
> >> How would I go about implementing this type of DataTable?
> >>
> >> Thanks in advance...
> >>
> >> Bill-
> >>
> >>
> >> -------------------------------------------------------------------
> >> -- To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.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