Scot Mcphee schrieb:
Hello

Does any one have a short recipe how to use a checkbox in a grid component?

What I need to do is fairly simple - let the use select (for example) three of five available options presented in a grid component, and submit their selections, which are then processed. A good example would be a "remove" checkbox on a list of items in a shopping cart, where the items are are only in the user's session so database IDs won't do.

I've tried looking through the wiki, searching google, searching the mailing list with google, and looking through the 'Tapestry 5 Building Web Applications' book which I bought as a PDF, but alas, I can't find find a simple recipe for doing this.

I'd like to use the Grid because the data will be fairly complex (it isn't for the time being, once I get this technique functional it will be). I'd like the selection to change a value in the underlying POJO (e.g. Pojo.selected) that's backing the Grid. I have been unable to get this anywhere near any semblance of "working". Therefore currently any sort of technique that could possibly work would be appreciated, for example to have an List<Pojo> originalList and List<Pojo> selectedList - I've tried to see what convention might give me that behaviour but so far, been unable to uncover it.


scot


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


Here is an example with the chenille components
http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/components/InPlaceEditor.html

Here is a snippet from my evaluation article, which I will publish this week.
extract of the template
<form t:type="form" t:id="addressForm">
        <t:errors/>
        <t:grid source="addresses" row="address">
                <p:nameCell>
                        <t:hidden value="address.id"/>
<input t:type="TextField" t:id="name" t:value="address.name" t:validate="required, maxlength=10" size="10"/>
                </p:nameCell>
                <p:cityCell>
<input t:type="TextField" t:id="city" t:value="address.city" t:validate="required, maxlength=10" size="10"/>
                </p:cityCell>
        </t:grid>
        <input type="submit" value="Save"/>
</form>
The page class
public class VariousComponents {

        private List<Address> addresses = new ArrayList<Address>();

        @Property
        private Address address;
        
        public VariousComponents() {
addresses.add(new Address("foo", "Bad Vilbel", "Germamy", "Bubenweg 1", Salutation.MR)); addresses.add(new Address("bar", "Aachen", "Germamy", "Neuer Weg 1", Salutation.MR)); addresses.add(new Address("bazz", "Frankfurt", "Germamy", "Neuer Weg 2", Salutation.MR)); addresses.add(new Address("bozz", "Chemnitz", "Germamy", "Hase 1", Salutation.MR));
                // just set an id value
                for(int i = 0; i< addresses.size();i++)
                        addresses.get(i).setId(i+1);
        }

        public List<Address> getAddresses() {
                return addresses;
        }
}


--
Best Regards / Viele Grüße

Sebastian Hennebrueder
-----
Software Developer and Trainer for Hibernate / Java Persistence
http://www.laliluna.de



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to