You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Darren Williams <da...@livetime.com> on 2010/08/12 22:46:55 UTC

Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

When upgrading to Tapestry 5.2 the inPlace Ajax grid no longer works. It appears to be related to the sorting and the fact that the _grid sort model gets reset to null when using the navigation. It works fine if you don't use the AJAX inPlace call.

Is anyone else seeing the same thing on Tap 5.2? It looks like the singleton pattern has changed the behavior.


    @Component(id="receiptGrid")
    private Grid _grid;
	
    @Inject
    private BeanModelSource beanModelSource;
    private BeanModel beanModel;
    @Inject
    private Messages messages;
	
	public void setupRender() {
		beanModel=beanModelSource.createDisplayModel(License.class, messages);
		beanModel.include("entered","endDate");
		beanModel.add("purchase.orgUnit.name").label("Organization");
		beanModel.add("purchase.product.name").label("Product");
		beanModel.add("purchase.licenseType.name").label("License");
		
		//sorting
		if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
			logger.warn("sort constraints");
			_grid.getSortModel().updateSort("entered");
			//this is still not exposed in tapestry 5.2 so you can't change order
			//_grid.setSortAscending(false);
	    }
	}
	
	public BeanModel getBeanModel() {
		return beanModel;
	}
	

cheers, darren

Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 12 Aug 2010 17:46:55 -0300, Darren Williams <da...@livetime.com>  
wrote:

> When upgrading to Tapestry 5.2 the inPlace Ajax grid no longer works. It  
> appears to be related to the sorting and the fact that the _grid sort  
> model gets reset to null when using the navigation. It works fine if you  
> don't use the AJAX inPlace call.

Hi!

Try this:

  	public BeanModel getBeanModel() {
  		beanModel=beanModelSource.createDisplayModel(License.class, messages);
  		beanModel.include("entered","endDate");
  		beanModel.add("purchase.orgUnit.name").label("Organization");
  		beanModel.add("purchase.product.name").label("Product");
  		beanModel.add("purchase.licenseType.name").label("License");
  		
  		//sorting
  		if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
  			logger.warn("sort constraints");
  			_grid.getSortModel().updateSort("entered");
  			//this is still not exposed in tapestry 5.2 so you can't change order
  			//_grid.setSortAscending(false);
  	    }
  	}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 12 Aug 2010 18:56:44 -0300, Darren Williams <da...@livetime.com>  
wrote:

> Thanks Thiago,

Hi!

> we were trying to avoid rebuilding the beanModelSource on each render,  
> because it is backed by a large dataset.

I can't see the relation between a large data set and the BeanModel  
creation. The same BeanModel instance is used to process all the objects  
shown in the grid.

> We have modified your suggestion as  shown below. Is this the best  
> technique to persist this value like we have here, instead of constantly  
> creating?

If you're using Tapestry 5.1.0.5 or below, you can annotate the beanModel  
field with @Retain and keep your getBeanModel() method as is. This way,  
the BeanModel instance will be created. You could also keep the BeanModel  
in a static field.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Tapestry 5.2 Grid inPlace Ajax navigation is no longer working

Posted by Darren Williams <da...@livetime.com>.
Thanks Thiago,

we were trying to avoid rebuilding the beanModelSource on each render, because it is backed by a large dataset. We have modified your suggestion as  shown below. Is this the best technique to persist this value like we have here, instead of constantly creating?

    @Persist
    private BeanModel beanModel;

    @Inject
    private Messages messages;
	
	public BeanModel getBeanModel() {
		//setup the model for this user
		if (beanModel == null) {
			beanModel=beanModelSource.createDisplayModel(License.class, messages);
			beanModel.include("entered","endDate");
			beanModel.add("purchase.orgUnit.name").label("Organization");
			beanModel.add("purchase.product.name").label("Product");
			beanModel.add("purchase.licenseType.name").label("License");
			
			//sorting
			if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
				_grid.getSortModel().updateSort("entered");
				//this is still not exposed in tapestry 5.2 so you can't change order
				//_grid.setSortAscending(false);
		    }
		}
		return beanModel;
	}


On Aug 12, 2010, at 1:46 PM, Thiago wrote:

> Hi!
> 
> Try this:
> 
>   	public BeanModel getBeanModel() {
>   		beanModel=beanModelSource.createDisplayModel(License.class, messages);
>   		beanModel.include("entered","endDate");
>   		beanModel.add("purchase.orgUnit.name").label("Organization");
>   		beanModel.add("purchase.product.name").label("Product");
>   		beanModel.add("purchase.licenseType.name").label("License");
>   		
>   		//sorting
>   		if (_grid.getSortModel().getSortConstraints().isEmpty() ) {
>   			logger.warn("sort constraints");
>   			_grid.getSortModel().updateSort("entered");
>   			//this is still not exposed in tapestry 5.2 so you can't change order
>   			//_grid.setSortAscending(false);
>   	    }
>   	}
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br

_____________________
Darren Williams
LiveTime Software Inc.
http://www.livetime.com
(949) 777 5800