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

Reply via email to