You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Swinsburg <st...@gmail.com> on 2009/07/11 15:57:10 UTC

getting child items of a ListView ListItem

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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
Ok thats working nicely, the ModalWindow callback is inside the  
onClick of the Link in the Item and using one instance of a MW per  
list instead of one per item.

Thanks for your help Martin :)

Regards.


On 12 Jul 2009, at 18:45, Martin Makundi wrote:

> BTW::: SHOW AFTER initializing callback.
>
> **
> Martin
>
> 2009/7/12 Martin Makundi <ma...@koodaripalvelut.com>:
>> Yes. Why make it more complex :)?
>>
>> **
>> Martin
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
BTW::: SHOW AFTER initializing callback.

**
Martin

2009/7/12 Martin Makundi <ma...@koodaripalvelut.com>:
> Yes. Why make it more complex :)?
>
> **
> Martin
>

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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Yes. Why make it more complex :)?

**
Martin

2009/7/12 Steve Swinsburg <st...@gmail.com>:
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users- 
>>>>>>>>>>>>> unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users- 
>>>>>>>>>>> help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users- 
>>>>>>>>>>> help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
So you setup a callback when you set the content on the modalWindow?  
That could work nicely as well.

Here's the new structure for your perusal:

<div wicket:id="resultsContainer">
	<div wicket:id="results-list">
		<div>some display stuff from the Item in here</div>		

		<div>
			<ul>
				<li wicket:id="connectionContainer">
					<a wicket:id="connectionLink">
						<span wicket:id="connectionLabel">add as a friend</span>
					</a>
				</li>
				<li wicket:id="viewFriendsContainer">
					<a wicket:id="viewFriendsLink">
						<span wicket:id="viewFriendsLabel">view friends</span>
					</a>
				</li>
			</ul>
		</div>
		
	</div>
</div>

<div wicket:id="connectionWindow"></div>	


The connectionLink sets the content for the MW based on the current  
Item, opens the window, does some stuff, it closes, then the callback  
fires which updates components in connectionContainer.




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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
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.

What I have done now is moved the MW outside so there is one per  
ListView, and the content of the MW is set when the link is clicked.  
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.

To plumb it all together I am setting the models on the items that  
need to be updated when the link is clicked, ie when I have the  
references already like you said, then keeping a reference to the  
container for the items that needs to be repainted (not the Item now),  
and then repainting the container in the callback if it was successful  
or not.

Seems to be working well so far.

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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
Yeah but I'm asking what is the best way to get a handle on a child  
component of a ListItem.

I understand I can update multiple components or repaint the whole  
lot,  but I have many ListItems in my ListView with the same child  
components in each, and I need to update one at a time, hence need to  
know which one I am working with at any given time.

So I am using:
-in ListItem and the Link onClick, get the parent Item. Keep a  
reference to this.
-Do the processing
-In window closed callback, drill into child components via  
item.get("path.to.child.elements"), update their models
-Repaint them.

Is this ok?


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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> 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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@gmail.com>.
I'm opening a ModalWindow from an AjaxLink inside the ListItem. When  
that closes, in the close handler I need to update a couple of text  
items in the ListItem then repaint them so they refresh.

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? It  
currently has a ResourceModel on it as it's an internationalised  
string. I'm just updating that model currently.

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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
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 <st...@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 <st...@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-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: getting child items of a ListView ListItem

Posted by Steve Swinsburg <st...@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 <st...@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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: getting child items of a ListView ListItem

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
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 <st...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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