I was able to make this work by including a TextField, a CheckBox and a Label in every cell of the table, then calling setVisible(false) on two of the three in every cell. Seems to work, and it was pretty simple to code and understand. Performance is acceptable for very small tables, but I haven't tried it yet on big stuff so I don't know how well it scales.
-- Jim On Sat, Sep 10, 2005 at 07:41:37AM +0100, Gwyn Evans wrote: > From: Gwyn Evans <[EMAIL PROTECTED]> > To: [email protected] > Subject: Re: [Wicket-user] form table with variable editable fields > Date: Sat, 10 Sep 2005 07:41:37 +0100 > > Have you investigated the alternative option of using the "read-only" > or "disabled" attributes on your input fields? > When it's back, www.cs.tut.fi/~jkorpela/forms/readonly.html has some > examples of their use and appearance. > > Other than that, Igor's suggestions of panels might be the easiest approach. > > /Gwyn > > On 10/09/05, Jim McBeath <[EMAIL PROTECTED]> wrote: > > I have a component that displays an html table with a variable number > > of rows and columns, similar to the TableGeneratorComponent in the > > displaytag example but with a model that goes along with it so that > > I can change the data and redisplay it. This works fine as long as > > I only want to display the data. > > > > Now I want to modify this component so that it has some form input fields > > in the table. I modified my model to have a method "isColumnEditable" > > that I call from the component to see if a column should be rendered as > > an input field or as simple text. That method call works fine, but I > > don't know how to set up my html file to select between an input field > > and a plain string. The html file currently has a <span> element which > > I attach to a Label for each cell of the table, but Wicket complains when > > I try to attach it to a TextField instead. I understand this, and I know > > I could hard-wire the html so that specific columns are editable, but I > > want a component that automatically configures which columns are editable > > based on the current state of the model. > > > > I was unable to find anything in the wiki or examples that showed how > > to select between two different types of fields based on program data. > > Can anyone point me to an example or let me know how I would do this? > > > > -- > > Jim McBeath ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
