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.

ie with your method
- create a modal window for the entire list (thats what I need)
- iterate over 5 items
- setup a callback for each item to update the text bits I need
-setup an AjaxLink for each item to open the window
- in onClick for this link, set the content for the window
- ModalWindow takes over and does some processing
- ModalWindow closes, callback updates a label.


Having one MW and one callback per list is working, I set the models for the things that need to be updated and actually refresh them to pickup the changes if it was successful, all in one go.

WDYT?

cheers



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 <[email protected]>:

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 <[email protected]>:

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: [email protected]
For additional commands, e-mail: [email protected]





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




---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]



---------------------------------------------------------------------
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]



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

Reply via email to