You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by bilgisever <me...@hotmail.com> on 2011/11/15 13:26:19 UTC

LoadableDetachableModel load() - Listview onclick()

     Simpy, I have a listview and a LoadableDetachableModel which is listview
Model. Listview has a link to populate. This Link has onclick event. 
The event is update the query for LoadableDetachableModel to load data and
list them in listview.

 But the problem is that event of LoadableDetachableModel load() is run
before event of Link onclick().  
 So the current query is not up to date. The query is previous one. List
also a previous. Many way I have on my mind. But I want a real and stable
solution. 
Thank you in advance.

-----
www.mehmetatas.info
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-load-Listview-onclick-tp4042769p4042769.html
Sent from the Users forum mailing list archive at Nabble.com.

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


AW: AW: LoadableDetachableModel load() - Listview onclick()

Posted by Sven Meier <sv...@meiers.net>.
Ok, then you have to call #detach() on your model:

	public void onClick() {
		stack.add(item.getModelObject().getAssetCod());
		loadModel.detach();
	}

Hope this helps
Sven

-----Ursprüngliche Nachricht-----
Von: bilgisever [mailto:mehmetates58@hotmail.com] 
Gesendet: Dienstag, 15. November 2011 15:57
An: users@wicket.apache.org
Betreff: Re: AW: LoadableDetachableModel load() - Listview onclick()

Yes, the link is a part of the listview. 

ListView :

ListView<AstPlans> breadList = new ListView<AstPlans>("breadList",loadModel)
{
			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(final ListItem<AstPlans>
item) {
				final Link<AstPlans> breadLink = new
Link<AstPlans>("breadLink",
item.getModel()) {
					private static final long
serialVersionUID = 1L;
					@Override
					public void onClick() {
	
stack.add(item.getModelObject().getAssetCod());
					}
				};
             breadLink.add(new
Label("breadLinkLabel",item.getModelObject().getAssetCode()+"-"+item.getMode
lObject().getName()));
				
	item.add(breadLink);
}

LoadableDetachable Model :

LoadableDetachableModel<List&lt;AstPlans>> loadModel = new
LoadableDetachableModel<List&lt;AstPlans>>() {
	private static final long serialVersionUID = 1L;
	@Override
	protected List<AstPlans> load() {
		List<AstPlans> list = service.findAsset(new
QueryOption(Filter.like("assetCode", stack.get(stack.size() - 1) + "___")));
		return list;
	}
};

   I update stack whick is a list. but the stack is updated after load
method is invoke. So load is give to me a list queried by oll stack. List
also old. I need stack is update first, then load() invoke or any other way
to succeed on this.
How can I over come this.

-----
www.mehmetatas.info
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-load-List
view-onclick-tp4042769p4043238.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
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: AW: LoadableDetachableModel load() - Listview onclick()

Posted by bilgisever <me...@hotmail.com>.
Yes, the link is a part of the listview. 

ListView :

ListView<AstPlans> breadList = new ListView<AstPlans>("breadList",loadModel)
{
			private static final long serialVersionUID = 1L;			
			@Override
			protected void populateItem(final ListItem<AstPlans> item) {
				final Link<AstPlans> breadLink = new Link<AstPlans>("breadLink",
item.getModel()) {
					private static final long serialVersionUID = 1L;
					@Override
					public void onClick() {
						stack.add(item.getModelObject().getAssetCod());
					}
				};
             breadLink.add(new
Label("breadLinkLabel",item.getModelObject().getAssetCode()+"-"+item.getModelObject().getName()));
				
	item.add(breadLink);
}

LoadableDetachable Model :

LoadableDetachableModel<List&lt;AstPlans>> loadModel = new
LoadableDetachableModel<List&lt;AstPlans>>() {
	private static final long serialVersionUID = 1L;
	@Override
	protected List<AstPlans> load() {
		List<AstPlans> list = service.findAsset(new
QueryOption(Filter.like("assetCode", stack.get(stack.size() - 1) + "___")));
		return list;
	}
};

   I update stack whick is a list. but the stack is updated after load
method is invoke. So load is give to me a list queried by oll stack. List
also old. I need stack is update first, then load() invoke or any other way
to succeed on this.
How can I over come this.

-----
www.mehmetatas.info
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-load-Listview-onclick-tp4042769p4043238.html
Sent from the Users forum mailing list archive at Nabble.com.

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


AW: LoadableDetachableModel load() - Listview onclick()

Posted by Sven Meier <sv...@meiers.net>.
LoadableDetachableModel#load() is invoked lazily only first access of the
model object.

Is your link part of the ListView? Does it access the row model before
changing the query?

Sven

-----Ursprüngliche Nachricht-----
Von: bilgisever [mailto:mehmetates58@hotmail.com] 
Gesendet: Dienstag, 15. November 2011 13:26
An: users@wicket.apache.org
Betreff: LoadableDetachableModel load() - Listview onclick()

     Simpy, I have a listview and a LoadableDetachableModel which is
listview
Model. Listview has a link to populate. This Link has onclick event. 
The event is update the query for LoadableDetachableModel to load data and
list them in listview.

 But the problem is that event of LoadableDetachableModel load() is run
before event of Link onclick().  
 So the current query is not up to date. The query is previous one. List
also a previous. Many way I have on my mind. But I want a real and stable
solution. 
Thank you in advance.

-----
www.mehmetatas.info
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/LoadableDetachableModel-load-List
view-onclick-tp4042769p4042769.html
Sent from the Users forum mailing list archive at Nabble.com.

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