Skip navigation
jeneasy
Currently Being Moderated

Can't link to filtered data in a master detail spry data set

Sep 29, 2011 9:17 AM

Tags: #url #spry #xml #filters

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

 
Replies
  • Currently Being Moderated
    Sep 29, 2011 10:10 AM   in reply to jeneasy

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 1, 2011 2:57 PM   in reply to jeneasy

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points