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