Hi there,
I have setup a content gallery for a staff profile page using a master detail spry xml data set. There have also been filters applied to this content to enable users to select content according to a specific category. You can see it in action here:
http://www.contentplus.com.au/people/
I've been trying to generate external links to the filtered content but just can't get it to work. I've tried to figure it this out using the various methods outlined in all the resources and guides on Adobe but just can't get it to work.
Would really appreciate out some help with this - I just want to be able to create links that automatically filter the content to a specific category when the page loads e.g. a link that only loads staff that are tagged with the category 'Project Management'.
The XML feed for this data set can be found here:
http://www.contentplus.com.au/portfolio.xml/
Thanks very much for any help or advice offered
![]()
Cheers,
Jenn
First of all you can use one function to do your filtering for each of the thinking groups. here's one of my filters,
// Filter for filtering topics by forumID
function FiltbyForum(forumID)
{
// Filter for topics by forum
var FilterbyForum = function(dataSet, row, rowNumber){
if (row["forum_id"] == forumID)
return row;
return null;
}
latesttopics.filter(FilterbyForum);
}
What you want to add is a querystring variable containing the filter you wish to apply.
http://www.contentplus.com.au/people?ID=whatever
You then want to retrieve the qeury string once you have defined you spry dataset by using SpryURLUtils
var params = Spry.Utils.getLocationParamsAsObject();
Then
if {params.ID)
{FiltbyCategory(ID)}
Changing the above to match your filter function etc,
Phil
Thankyou so much for your prompt reply. I've tried your recommendation but I don't think I've interpreted it right - here's what I've done (on the test site):
function FiltbyForum(forumID)
{
var FilterbyForum = function(dataSet, row, rowNumber){
if (row["@categories"] ==3)
return row;
return null;
}
ds2.filter(FilterbyForum);
}
var params = Spry.Utils.getLocationParamsAsObject();
if {params.@categories)
{FiltbyCategory(@categories)}
Apologies...I'm still new to spry (but trying to learn as quickly as possible). I love it but still haven't quite got it all understood yet.
Many thanks for any further advice :-) :-)
cheers,
Jenn
Hi,
Try the below as you've hard coded the category and left the function name at the top as per my original extract (so it doesn't match the filter function name at the bottom).
function FiltbyCategory(ID)
{
var FilterbyCategory = function(dataSet, row, rowNumber){
if (row["@categories"] == ID)
return row;
return null;
}
ds2.filter(FilterbyCategory);
}
var params = Spry.Utils.getLocationParamsAsObject();
if {params.@categories)
{FiltbyCategory(@categories)}
Something you could do is add following just before the last if
alert(params.@categories);
Just to test that it is picking up your URL parameter correctly
Regards
Phil
North America
Europe, Middle East and Africa
Asia Pacific