Disclaimer: This widget and website is not affiliated with Yahoo in any way.
- License: The Tags Widget is licensed under the same terms as the YUI Library, which is issued under a BSD license.
- Download: Download the Filter Widget.
- Prerequisites: Download YUI as part of the full YUI Library on SourceForge.
- Documentation: View the full API documentation for the Filter Widget
To use the Filter widget/component, include the following source files in your web page with the script tag:
Your Filter Widget implementation will consist of one instantiatiable object:
- FilterWidget - when bound to an HTML div, this object will render and handle all user interface interactions. It also provides several events that one can subscribe to in order to handle specific key events.
Instantiating the Filter Widget
The Filter Widget constructor has one required parameter:
- the ID of the HTML object to which the widget will be bound and rendered.
For each "constraint" or value you want to filter your results by, you will need to instantiate and add a Constraint object to the Filter widget. Each constraint allows a user to specify a set of possible values to filter by, the label for the constraint, the HTML input element name and whether the constraint is "active" by default.
Setting a constraint to active by default
Unless otherwise specified, the filter widget will not apply any constraints to the filter, but will set all constraints in an 'inactive' state so that a user can apply them manually one-by-one. But if a user needs to have a constraints applied to a filter by default, say when the page is initially rendered, then they would set the "selected" property to 1, like so:
Subscribing to Filter Events
The Filter Widget has a custom event that one can subscribe to. This event is fired whe the user clicks the "Filter" button.
If you have questions or problems using this widget/code, please visit the majordojo discussion forums.
For questions and issues with using the Yahoo UI Framework, please visit Yahoo's developer web site.