[prev in list] [next in list] [prev in thread] [next in thread] 

List:       myfaces-user
Subject:    Re: Creating a HtmlDataTable(like) with a dynamic number of columns and rows
From:       Sean Schofield <sean.schofield () gmail ! com>
Date:       2005-04-29 2:28:07
Message-ID: 2387fbc5050428192867d728ac () mail ! gmail ! com
[Download RAW message or body]

Take a look at the simple examples webapp.  You will find it in the
latest CVS code (or get the latest nightly build.)  There is an
example there that uses x:dataTable, x:columns and x:dataScroller
together.  I believe this achieves what you want.

It took a little while to figure out how these components worked
together but they are pretty powerful.

HTH,

sean

On 4/28/05, Mike Kienenberger <mkienenb@gmail.com> wrote:
> I could use some advice.
> 
> I need a component that can have a dynamic number of rows and columns,
> preferably with HtmlSelectBooleanCheckbox controls in each cell, and
> the control in the cell needs to know what object-backed column it is
> in so it can get/set values based on both the row and column.
> Getting the row object is easy enough via HtmlDataTable.getRowData().
> 
> Currently, I've written some ugly hack code that subclasses
> HtmlSelectBooleanCheckbox to store a "context" column object, reads a
> delegate object out of the "valueSource" ValueBinding, and overrides
> getValue() to call "valueSource".getValueFor(contextObject).  I also
> override saveState/restoreState to save both parameters.
> 
> I then manually add columns containing
> ContextProvidingHtmlSelectBooleanCheckbox objects to an HtmlDataTable
> and set a ValueChangeListener (along with "valueSource") so I can be
> notified when the data changes.
> 
> And this ugly hack works somewhat.  (I still have the problem where
> after the page is redisplayed, the initial values of all of the
> Checkboxes are lost, but I'll probably figure out that issue
> eventually.)
> 
> However, this can't be the best way to handle a variable-width HtmlDataTable.
> 
> Is my only other solution to create a custom HtmlDataTable component
> from scratch?  Or is there an easier solution I'm overlooking?
> Having a control that supports N x M data manupulation seems like
> pretty basic functionality.
> 
> Thanks,
> 
> -Mike
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic