You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sandeepraj singh <sa...@atosorigin.com> on 2009/12/03 08:23:43 UTC

Grid Sorting images changed - One of the approaches provided

Hi,
We have a component MyGrid which has embedded Tapestry5 Grid component.
We needed to change the sorting images with our own and had first applied
the changes through css.
However, it was giving problems of space consistency.

In order to better it, we have initialized the below script through
renderSupport. The below solution works but it will fail if Sir Howard
Lewis, tomorrow changes the imagenames. Any inputs please?.

var MyGrid = Class.create();
MyGrid.prototype = {
initialize: function() {
this.sortImage();
},
sortImage : function(){
var objectArray = $$('img.t-sort-icon');
for(var i = 0; i < objectArray.size(); i++)
{
var imgSrc = objectArray[i].src;

if (imgSrc.indexOf("sort-asc.png")!=-1)
{
objectArray[i].src = "OurAscImage";
}
else if(imgSrc.indexOf("sort-desc.png")!=-1)
{
objectArray[i].src = "OurDownImage";
}
else if(imgSrc.indexOf("sortable.png")!=-1)
{
objectArray[i].src = "SpaceImage"; //To remove the empty effects
}
}
}
}


Thanks

Sandeep and Abhijit


-- 
View this message in context: http://old.nabble.com/Grid-Sorting-images-changed---One-of-the-approaches-provided-tp26621714p26621714.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Grid Sorting images changed - One of the approaches provided

Posted by sandeepraj singh <sa...@atosorigin.com>.
Hi Thiago,
I agree to your point that changing css should be the ideal way to change
images.
The problem was that when we changed image through css, the position was to
be decided for each column seperately. Hence as a temporary measure we have
put this script which works fine
sortImage : function(path){
			
		path = "/"+path+"/assets/kawwa/imgs/";
		
		var objectArray = $$('img.t-sort-icon');
		
		for(var i = 0; i < objectArray.size(); i++)
		{
			objectArray[i].src = path+"spacer.gif";
		}
		
		var ascSortImg = $$('a.t-sort-column-ascending img');
		
		for(var i = 0; i < ascSortImg.size(); i++)
		{
			ascSortImg[i].src = path+"pic_up.gif";
		}
		
		var desSortImg = $$('a.t-sort-column-descending img');
		
		for(var i = 0; i < desSortImg.size(); i++)
		{
			desSortImg[i].src = path+"pic_down.gif";
		}

	 }//function ends

We will surely look at a more standard css way to do it. CSS Solutions that
we worked on before writing this script was not fool proof. In this script
now, there is no dependency on any of the existing images from grid

Thanks



Thiago H. de Paula Figueiredo wrote:
> 
> Em Thu, 03 Dec 2009 05:23:43 -0200, sandeepraj singh  
> <sa...@atosorigin.com> escreveu:
> 
>> Hi,
> 
> Hi!
> 
>> We have a component MyGrid which has embedded Tapestry5 Grid component.
>> We needed to change the sorting images with our own and had first applied
>> the changes through css. However, it was giving problems of space  
>> consistency.
> 
> Changing the images through CSS is the recommended way of doing it. If it  
> was giving problems of space consistency, you should fix your CSS.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, software architect and developer, 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Grid-Sorting-images-changed---One-of-the-approaches-provided-tp26621714p26635757.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Grid Sorting images changed - One of the approaches provided

Posted by sandeep learning tapestry <sa...@atosorigin.com>.
We finally used method advice whereby we advised assetSource service and
changed the parameter to point to my images.

-----
Thanks,
Sandeep
"Learning Tapestry"
-- 
View this message in context: http://n2.nabble.com/Grid-Sorting-images-changed-One-of-the-approaches-provided-tp4104570p4685175.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

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


Re: Grid Sorting images changed - One of the approaches provided

Posted by sandeepraj singh <sa...@atosorigin.com>.
Hi Thiago,
I agree to your point that changing css should be the ideal way to change
images.The problem was that when we changed image through css, we had to do
image.display = none and then provide a background to the anchor tags above
it with our images.. 

This caused the position of our image to be unfixed relative to the column
sizes. As a temporary measure we have put a script which first replaces the
existing t-sort-icon with a spacer.gif to remove out the existing sorting
image and then based on search for t.sort-column-ascending img and
t.sort-column-descending img(using prototype doubledollar), we change the
source with our images. 

This way, we have solved the problem that i highlighted in my post
yesterday(i.e how to avoid dependency of the images from grid).We will
surely look at a more standard css way to do it later.

Thanks

Sandeep

Thiago H. de Paula Figueiredo wrote:
> 
> Em Thu, 03 Dec 2009 05:23:43 -0200, sandeepraj singh  
> <sa...@atosorigin.com> escreveu:
> 
>> Hi,
> 
> Hi!
> 
>> We have a component MyGrid which has embedded Tapestry5 Grid component.
>> We needed to change the sorting images with our own and had first applied
>> the changes through css. However, it was giving problems of space  
>> consistency.
> 
> Changing the images through CSS is the recommended way of doing it. If it  
> was giving problems of space consistency, you should fix your CSS.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, software architect and developer, 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Grid-Sorting-images-changed---One-of-the-approaches-provided-tp26621714p26635851.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Grid Sorting images changed - One of the approaches provided

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 03 Dec 2009 05:23:43 -0200, sandeepraj singh  
<sa...@atosorigin.com> escreveu:

> Hi,

Hi!

> We have a component MyGrid which has embedded Tapestry5 Grid component.
> We needed to change the sorting images with our own and had first applied
> the changes through css. However, it was giving problems of space  
> consistency.

Changing the images through CSS is the recommended way of doing it. If it  
was giving problems of space consistency, you should fix your CSS.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, 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