Yes, you are right, I invented the previous code. The next piece of code from
my project works fine exactly ;)
columns.add(new AbstractColumn(new Model("")) {
@Override public Component getHeader(String componentId) {
Fragment checkBoxFragment = new
IssueSelectionFragment(componentId, "checkBoxFrag", IssuesTabularPanel.this,
new Issue());
checkBoxFragment.add(new AttributeModifier("title", true,
new Model("...")));
return checkBoxFragment;
}
public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
Issue issue = (Issue) rowModel.getObject(cellItem);
Fragment checkBoxFragment = new
IssueSelectionFragment(componentId, "checkBoxFrag", IssuesTabularPanel.this,
issue);
checkBoxFragment.add(new AttributeModifier("title", true,
new Model("...")));
cellItem.add(checkBoxFragment);
cellItem.add(new AttributeModifier("class", true, new
Model("check")));
}
});
....
private static final class IssueSelectionFragment extends Fragment {
public IssueSelectionFragment(String id, String markupId,
MarkupContainer markupProvider, Issue issue) {
super(id, markupId, markupProvider);
add(new CheckBox("selected", new AbstractCheckBoxModel() {
@Override public void setSelected (Component component,
boolean sel) {
....
}
@Override public boolean isSelected(Component component)
{
return false;
}}) {
@Override protected boolean
wantOnSelectionChangedNotifications() {
return true;
}
});
}
}
igor.vaynberg wrote:
>
> you cannot do this, you have to add a panel or a fragment that contains
> the
> link you want. this is because whatever you add is attached to <span>
> tags,
> and you cannot attach a link to a <span>, only to
>
> -igor
>
>
> On 11/14/06, dulanov <[EMAIL PROTECTED]> wrote:
>>
>>
>> To add a bookmarkable link:
>>
>> columns.add(new AbstractColumn(new Model("column6"), "column6") {
>>
>> public void populateItem(Item cellItem, String componentId,
>> IModel rowModel) {
>> cellItem.add(new BookmarkablePageLink(componentId,
>> SomePage.class, somePageParameters)));
>> }
>> });
>>
>>
>> dulanov wrote:
>> >
>> > 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
>> >>> > > [email protected]
>> >>> > > 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
>> >>> > [email protected]
>> >>> > 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
>> >>> [email protected]
>> >>> 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
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-DataTable-tf2627657.html#a7352979
>> 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
>> [email protected]
>> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
--
View this message in context:
http://www.nabble.com/Question-about-DataTable-tf2627657.html#a7353431
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user