Are you wanting to perform this filtering asynchronously with JavaScript or are you thinking the page will reload?
For a asynchronous solution if you are using Umbraco v6.1 the recommended approach is to use UmbracoApi Controller There is a very good blog post here also.
If you are using a older version of Umbraco and cannot upgrade then the approach is to use the /base Api
You will of course need some jQuery or other JS Ajax handler to request the data and decide if you do the filtering client side or have a parameter you pass with the request and make a Ajax request each time the filter is changed.
If you are looking for a classic querystring/page reload solution have a look at this thread which is very similar.
Filter contents in relation to value selected from a drop down box
I want to filter a list of contents based on the values selected in a drop down box.
This is my workflow.
When the page loads, it displays a list of fruits.
There will a drop down box at the top of the page which says Color. And I would select "red" and hit update.
That should clear the list below and show all fruits, which are of color "Red"
Note: Each of these fruits will have a seperate property called color. Which I have not listed, But I know we are filtereing on that property.
How can I achieve this?
I hope its something similar to this:
<ul>
@
foreach
(var item
in
@Model.Children.Where(
"Red"
))
{
<li>@item.Name</li>
}
</ul>
Hi again,
Are you wanting to perform this filtering asynchronously with JavaScript or are you thinking the page will reload?
For a asynchronous solution if you are using Umbraco v6.1 the recommended approach is to use UmbracoApi Controller There is a very good blog post here also.
If you are using a older version of Umbraco and cannot upgrade then the approach is to use the /base Api
You will of course need some jQuery or other JS Ajax handler to request the data and decide if you do the filtering client side or have a parameter you pass with the request and make a Ajax request each time the filter is changed.
If you are looking for a classic querystring/page reload solution have a look at this thread which is very similar.
Thanks,
Jeavon
is working on a reply...