Ah so you attach the callback to the modal in the Link onClick, not in the item itself?

pseudocode:

init modalwindow();

listview {
        populate item {
                link {
                        onClick {
                                get item
                                set content for modalwindow
                                show modalwindow
                                SETUP CALLBACK HERE?
                        }
                }
                //I thought you meant here
        }
}


So if you mean where its in CAPS then ok, I thought you meant in the Item section. Will give it a go.

Steve


On 11 Jul 2009, at 21:02, Martin Makundi wrote:

Ok, except remember this is in a ListView so for each ListItem that I set the callback for, the single instance of the modal window is being updated to the latest callback. So when it fires, it will operate on the last item
in the list.

No. The callback is issued when you click the button.

**
Martin




On 11 Jul 2009, at 13:43, Martin Makundi wrote:

So you setup a callback when you set the content on the modalWindow? That
could work nicely as well.

Yes:

              modalWindow.setTitle(xx);
              modalWindow.setContent(yy);
              final AjaxButton ajaxButton = this;
              modalWindow.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback() {
                public void onClose(AjaxRequestTarget target) {
                  // Do your magic here
                  ...
                  target.addComponent(form);


target .addComponent (AbstractInnerPanel.getFeedbackPanel(WizardPanel.this));
                }
              });
              modalWindow.show(target);
              MarkupUtils.resizeModalWindow(target, 850, 400);

Here's the new structure for your perusal:

Your java was the curious part, but try the example above, position
the close callback together with showing it.

**
Martin





On 11 Jul 2009, at 12:17, Martin Makundi wrote:

Ok so I was doing that before but had an instance of a ModalWindow per ListItem, and the associated callback for each. Because it was all
inside,
it was self contained so I could do all the updating easily. But this
mean
many MW and callbacks per page.

Sounds wild..

This also means the callback is outside so it doesn't know about the object that was clicked. I did this so it reduces the total number of
objects
on the page.

Why not put the callback inside too.. I do that.

**
Martin

cheers.


On 11 Jul 2009, at 12:00, Martin Makundi wrote:

So I am using:
-in ListItem and the Link onClick, get the parent Item. Keep a
reference
to
this.

Why don't you already add all the necessary children to the
ajaxRequestTarget here where you have the references?

**
Martin


On 11 Jul 2009, at 11:36, Martin Makundi wrote:

I've got one Modal/handler per ListView so it needs to know what
item
it
was
clicked from so i still need to get a handle on the component
itself
to
update it, even if it gets its text from that model yes?

No. You can update multiple components with
ajaxRequestTarget.addChildren or you can differentiate with
component
class if absolutely necessary. Or you can repaint the whole
listView.

**
Martin




Thanks.


On 11 Jul 2009, at 10:43, Martin Makundi wrote:

It would be better design to make the span update itself using an
abstract readnly model:

new Label("automatic", new AbstractReadOnlyModel<String>() {
public String getObject() {
 return "whatever value you need" +
getSession().getCurrentValueOrState();
}
});.

**
Martin

2009/7/11 Steve Swinsburg <steve.swinsb...@gmail.com>:

Yeah that sounds like what I need. I need to update some text in
a
span
thats inside my ListItem once I do some processing.

Thanks,
Steve




On 11 Jul 2009, at 10:16, Martin Makundi wrote:

ListView returns an iterator of ListItems

Each ListItem is a component so you can just do
listItem.get("component_id");

Does this sound like what you were looking for?

**
Martin

2009/7/11 Steve Swinsburg <steve.swinsb...@gmail.com>:

Hi all,

I have a ListView and need to be able to get some child items
of
a
particular ListItem, ie some spans, so that I can update their
Models.
How
can I target some markup elements inside the ListItem container
(ie
TR
tag)?

Thanks,
Steve






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: users- unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users- h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to