Thanks guys - I appreciate all your help. I've decided to go with DataView
over DefaultDataTable because I couldn't get the "click on column value for
link"[1] to work.
Unfortunately, the following doesn't work with Wicket 1.2.6:
item.add(new AttributeModifier("class",
true, new AbstractReadOnlyModel()
{
public Object getObject()
{
return (item.getIndex() % 2
== 1) ? "even" : "odd";
}
}));
I tried the following (I'm a complete newbie, so sorry if this is dumb), but
it doesn't work:
public Object getObject(Component component) {
Item item = (Item) component;
return (item.getIndex() % 2 == 1) ? "even" : "odd";
}
Matt
[1] http://tinyurl.com/yw3e5l
Matej Knopp-2 wrote:
>
> Hi,
>
> the code for sortable pageable list can look like this:
>
> public class SortingPage extends BasePage
> {
>
> public SortingPage()
> {
> SortableContactDataProvider dp = new
> SortableContactDataProvider();
> final DataView dataView = new DataView("sorting", dp)
> {
> protected void populateItem(final Item item)
> {
> Contact contact =
> (Contact)item.getModelObject();
> item.add(new ActionPanel("actions",
> item.getModel()));
> item.add(new Label("contactid",
> String.valueOf(contact.getId())));
> item.add(new Label("firstname",
> contact.getFirstName()));
> item.add(new Label("lastname",
> contact.getLastName()));
> item.add(new Label("homephone",
> contact.getHomePhone()));
> item.add(new Label("cellphone",
> contact.getCellPhone()));
>
> item.add(new AttributeModifier("class", true,
> new
> AbstractReadOnlyModel()
> {
> public Object getObject()
> {
> return (item.getIndex() % 2 ==
> 1) ? "even" : "odd";
> }
> }));
> }
> };
>
> dataView.setItemsPerPage(8);
>
> add(new OrderByBorder("orderByFirstName", "firstName", dp));
>
> add(new OrderByBorder("orderByLastName", "lastName", dp));
>
> add(dataView);
>
> add(new PagingNavigator("navigator", dataView));
> }
> }
>
> -Matej
>
> On 4/25/07, mraible <[EMAIL PROTECTED]> wrote:
>>
>> That site has a way to view the source of the templates, but not the Java
>> code. Anywhere I can download that?
>>
>> What's the least amount of required classes to do a sortable/pageable
>> grid
>> with i18n? Compared to all the other web frameworks I've used, Wicket
>> seems
>> to make this the most difficult. Stripes is 30 lines of Java code and 20
>> lines of JSP. ;-)
>>
>> I know, I know - Wicket gives you a much more powerful way to do grids -
>> but
>> does it offer a simplistic grid as well?
>>
>> Thanks,
>>
>> Matt
>>
>>
>> igor.vaynberg wrote:
>> >
>> > see
>> >
>> > http://wicketstuff.org/wicket13/repeater/
>> >
>> > namely the datatable example
>> >
>> > -igor
>> >
>> >
>> > On 4/24/07, mraible <[EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> What's the easiest way to do a pageable/sortable list with
>> >> Wicket? Looking
>> >> at the following example, there's quite a few files required to
>> replicate
>> >> the DisplayTag's functionality.
>> >>
>> >> http://www.wicket-library.com/wicket-examples/displaytag
>> >>
>> >> Is this packaged up as a component I can use?
>> >>
>> >> The other example I found was "wicket_crud" and it seems to require 4
>> >> Java
>> >> files just for a list screen - not example simple in my mind. ;-)
>> >>
>> >> Matt
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/What%27s-the-easiest-way-to-do-a-pageable-sortable-list-screen--tf3639929.html#a10165178
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> -------------------------------------------------------------------------
>> >> This SF.net email is sponsored by DB2 Express
>> >> Download DB2 Express C - the FREE version of DB2 express and take
>> >> control of your XML. No limits. Just data. Click to get it now.
>> >> http://sourceforge.net/powerbar/db2/
>> >> _______________________________________________
>> >> Wicket-user mailing list
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >
>> >
>> -------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > Wicket-user mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/What%27s-the-easiest-way-to-do-a-pageable-sortable-list-screen--tf3639929.html#a10171203
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
--
View this message in context:
http://www.nabble.com/What%27s-the-easiest-way-to-do-a-pageable-sortable-list-screen--tf3639929.html#a10172259
Sent from the Wicket - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user