PDA

View Full Version : How to render a filter list in a grid?



mfrancey
11 May 2011, 4:07 AM
Hi there!

I'd like to render the filter option list.
Instead of having just the text ('small','medium','large',...), I'd like to have an icon first:

Wanted code for rendered list:
<img src="./smallIcon.gif"> Small
<img src="./mediumIcon.gif"> Medium
<img src="./largIcon.gif"> Large

How to do this? Is it possible?

Thanks for your answer

Marc

mfrancey
12 May 2011, 3:24 AM
I've found a solution that is not very elegant, but it works:



I defined the options with the html code...

options:[
'<span style="background-image:url(small.png); background-repeat:no-repeat;background-position:left top;padding:0 0 0 20px;">Small</span>',
'<span style="background-image:url(medium.png); background-repeat:no-repeat;background-position:left top;padding:0 0 0 20px;">Medium</span>',,
'<span style="background-image:url(large.png); background-repeat:no-repeat;background-position:left top;padding:0 0 0 20px;">Large</span>' ]
...and then remove the tags server side to treat the posted value:


trim(strip_tags($_POST['the_filter_value']))