no, i dont think its rendered in the super called, only prepared for
rendering so his code should work just fine.

set a breakpoint and see if its being called. also what markup is the
listview attached to?

-igor

On Tue, May 18, 2010 at 11:51 PM, Jeremy Thomerson
<[email protected]> wrote:
> try doing the tag.put("class", "foo") BEFORE the super.onComponentTag -
> which is where the tag is rendered
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Wed, May 19, 2010 at 1:48 AM, JeroenWolff <[email protected]> wrote:
>
>>
>> Igor, thanks you've helped me a lot...but now i repaint the whole table and
>> on every onComponentTag i update the class if the item is selected or not.
>> I
>> see in the debugger that onComponentTag and the tag.put("class",
>> "selected")
>> but it is not rendered.
>>
>> What do i do wrong??
>>
>> Thanks!!
>>
>> This is my code:
>>
>> public class HomePage extends BasePage {
>>        private KlantContact selected = new KlantContact();
>>        private Panel detailPanel = new DetailPanel("details", selected);
>>        private PageableListView<KlantContact> listView = null;
>>        private List<KlantContact> klantContacten = null;
>>
>>       �...@springbean
>>        private KlantContactDAO dao;
>>
>>        public HomePage(PageParameters parameters) {
>>          String bsn = parameters.getString("bsn");
>>          InjectorHolder.getInjector().inject(this);
>>
>>          final WebMarkupContainer tabel = new WebMarkupContainer("tabel");
>>          klantContacten = dao.geefKlantContactenVanDeLaatste2Maanden(bsn,
>>                                new LocalDateTime());
>>
>>          listView = new PageableListView<KlantContact>("zoekresultaat",
>>                                klantContacten, 5) {
>>                        private static final long serialVersionUID = 1L;
>>
>>                       �...@override
>>                        protected ListItem<KlantContact> newItem(int index)
>> {
>>                                ListItem<KlantContact> item = new
>> ListItem<KlantContact>(index,
>>                                                getListItemModel(getModel(),
>> index)) {
>>                                        private static final long
>> serialVersionUID = 1L;
>>
>>                                       �...@override
>>                                        protected void
>> onComponentTag(ComponentTag tag) {
>>                                                super.onComponentTag(tag);
>>                                                if (getModelObject() ==
>> selected) {
>>                                                        tag.put("class",
>> "welselected");
>>                                                } else {
>>                                                        tag.put("class",
>> "notselected");
>>                                                }
>>                                        }
>>
>>                                };
>>                                item.setOutputMarkupId(true);
>>                                return item;
>>                        }
>>
>>                       �...@override
>>                        protected void populateItem(final
>> ListItem<KlantContact> item) {
>>                                KlantContact contact =
>> item.getModelObject();
>>
>>                                final AjaxFallbackLink<KlantContact>
>> contactDatumLink = new
>> AjaxFallbackLink<KlantContact>(
>>                                                "contactdatumlink") {
>>                                        private static final long
>> serialVersionUID = 1L;
>>
>>                                       �...@override
>>                                        public void
>> onClick(AjaxRequestTarget target) {
>>                                                // het geselecteerde
>> KlantContact bepalen
>>                                                selected = (KlantContact)
>> getParent()
>>
>>  .getDefaultModelObject();
>>                                                // het detailpanel vervangen
>> met een nieuw detailpanel
>>                                                // waar de gelecteerde
>> klantcontact details op komen.
>>                                                DetailPanel replacement =
>> new DetailPanel("details",
>>                                                                selected);
>>
>>  replacement.setOutputMarkupId(true);
>>
>>  detailPanel.replaceWith(replacement);
>>                                                detailPanel = replacement;
>>
>>                                                if (target != null) {
>>
>>  target.addComponent(detailPanel);
>>                                                        // render de
>> listview opnieuw om de selected css te zetten
>>
>>  target.addComponent(tabel);
>>                                                }
>>
>>                                        }
>>
>>                                };
>>                                contactDatumLink.add(new
>> Label("contactdatumlinklabel",
>>                                                new
>> PropertyModel<KlantContact>(contact,
>>
>>  "getContactDatumTijdDDMMYYHHMM")));
>>                                item.add(contactDatumLink);
>>                                item.add(new Label("soort",
>> contact.getContactWijze()));
>>                                item.add(new Label("omschrijving", contact
>>                                                .getOmschrijving()));
>>                        }
>>
>>                };
>>                tabel.setOutputMarkupId(true);
>>                listView.setOutputMarkupId(true);
>>                tabel.add(listView);
>>                add(tabel);
>>                add(new AjaxPagingNavigator("navigator", listView));
>>                detailPanel.setOutputMarkupId(true);
>>                add(detailPanel);
>>        }
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/ListView-highlight-selected-row-tp2197486p2222348.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to