May be usefull my follow code snippet:

        List<IColumn> columns = new ArrayList<IColumn>();
        columns.add(new PropertyColumn(new Model("column1"), "column1",
"column1"));
        columns.add(new AbstractColumn(new Model("column2"), "column2") {
            @Override public Component getHeader(String componentId) {
                // To redefine a header representation
            }

            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                Issue issue = (Issue) rowModel.getObject(cellItem);
                cellItem.add(new Label("something"));
            }
        });
        columns.add(new PropertyColumn(new Model("column3"), "column3",
"column3"));
        columns.add(new PropertyColumn(new Model("column4"), "column4",
"column4"));
        columns.add(new PropertyColumn(new Model("column5"), "column5",
"column5"));
        columns.add(new AbstractColumn(new Model("column6"), "column6") {

            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                Issue issue = (Issue) rowModel.getObject(cellItem);
                cellItem.add(new Label(componentId, "something"));
            }
        });

        table = new DataTable("table", columns.toArray(new
IColumn[columns.size()]), proveder, 25) {

            @Override protected Item newRowItem(String id, int index, IModel
model) {
                Item item = new OddEvenItem(id, index, model);
                ModelObject object = (ModelObject) model.getObject(item);
                String url = "location.href='" + urlFor(IssuePage.class,
SomePage.getPageParameters(object.getId())) + "';";
                item.add(new AttributeModifier("title", true, new Model("a
title")));
                item.add(new AttributeModifier("onclick", true, new
Model(url)));
                return item;
            }
        };
        table .addTopToolbar(new OwnHeadersToolbar(table, provider));

        add(table );
    }

    private static final class OwnHeadersToolbar extends HeadersToolbar {

        public IssueHeadersToolbar(DataTable table, ISortStateLocator
stateLocator) {
            super(table, stateLocator);
            ...
        }
    }


igor.vaynberg wrote:
> 
> see addTopToolbar(), addBottomToolbar() and the constructor of
> DefaultDataTable
> 
> -igor
> 
> 
> On 11/14/06, Carfield Yim <[EMAIL PROTECTED]> wrote:
>>
>> I just really try out this class with only PropertyColumn. However, I
>> still get this error when I add HeadersToolbar like
>>
>>         table.add(new HeadersToolbar(table, provider));
>>
>> [MarkupContainer [Component id = datatable, page = <No Page>, path =
>> datatable.DataTable]]
>> java.lang.IllegalArgumentException: A child with id 'toolbar' already
>> exists:
>> [MarkupContainer [Component id = datatable, page = <No Page>, path =
>> datatable.DataTable]]
>>
>> Would you help me about that? I don't no idea and there is no
>> component call toolbar I've created
>>
>> On 11/14/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>> > there is an example in wicket-phonebook which lives in wicket-stuff
>> svn.
>> >
>> > basically you extend the abstractcolumn and add a panel or a fragment.
>> its
>> > pretty easy. look at the example - mainly in
>> listcontactspage/actioncolumn i
>> > believe
>> >
>> > -igor
>> >
>> >
>> >
>> > On 11/13/06, Carfield Yim <[EMAIL PROTECTED]> wrote:
>> > >
>> > > Look like it is more easier to show a sortable and pagable table than
>> > > using DataView. However if I need to show more than property from an
>> > > object. Like a BookmarkablePageLink , How should I do? Look like I
>> > > need to extended a custom AbstractColumn. Where can I find samples of
>> > > doing that?
>> > >
>> > >
>> >
>> -------------------------------------------------------------------------
>> > > Using Tomcat but need to do more? Need to support web services,
>> security?
>> > > Get stuff done quickly with pre-integrated technology to make your
>> job
>> > easier
>> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> > >
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> > > _______________________________________________
>> > > Wicket-user mailing list
>> > > Wicket-user@lists.sourceforge.net
>> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > >
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > Using Tomcat but need to do more? Need to support web services,
>> security?
>> > Get stuff done quickly with pre-integrated technology to make your job
>> > easier
>> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> >
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> >
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>> >
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-DataTable-tf2627657.html#a7352935
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to