Thanks.

It worked with 

@Override
                        protected void onComponentTagBody(
                                MarkupStream markupStream, ComponentTag 
openTag) {
                            // TODO Auto-generated method stub
                            replaceComponentTagBody(markupStream, openTag,
                                    getModelObject());
                        }

                        @Override
                        protected void onComponentTag(ComponentTag tag) {
                            // TODO Auto-generated method stub
                            tag.setName("a");
                            super.onComponentTag(tag);
                        }

On 03.02.2010, at 01:06, Igor Vaynberg wrote:

> search this link for TextLink, or create a panel/fragment that contain
> a link and a label
> 
> -igor
> 
> On Tue, Feb 2, 2010 at 3:04 PM, zkn <z...@abv.bg> wrote:
>> Hi,
>> 
>> I'm have a problem adding an AjaxLink to a DataTable cell. Everything works 
>> fine except that I don't know how to set the text for the link.
>> The result is that I see only  "[cell]" as a text in the cell but onClick() 
>> works fine.
>> 
>> Here is my code:
>> 
>> columns.add(new AbstractColumn<Book>(new Model<String>("Title")) {
>> 
>>                        public void populateItem(Item<ICellPopulator<Book>> 
>> cellItem,   String componentId, IModel<Book> model) {
>> 
>>                                final Book book = model.getObject();
>> 
>>                                if (book.getAuthor() == null) {
>> 
>>                                    book.setAuthor( new Author());
>> 
>>                                    AjaxLink<String> link = new 
>> AjaxLink<String>(componentId, new Model<String>("change author")) {
>>                                        @Override
>>                                        public void onClick(AjaxRequestTarget 
>> target) {
>> 
>>                                                modalWindow.setContent(new 
>> AuthorSwitchPanel(modalWindow
>>                                                        .getContentId(), new 
>> Model<Author>(book.getAuthor())));
>>                                                modalWindow.show(target);
>>                                        }
>>                                    };
>> 
>>                                    cellItem.add(link);
>>                                }
>>                                else
>>                                        cellItem.add(new Label(componentId,
>>                                                        new 
>> PropertyModel<Author>(book.getAuthor(), "name")));
>>                        }
>> });
>> 
>> 
>> 

Reply via email to