Caridy Patino![]()
Smart List will allow you to display a list of elements (not necessarily using UL/LI), and filtering which element should be displayed based on a selector. This component will be the base component for quicksand as well.
The general idea comes from few javascript components:
- Smart Lists - Prototype Extension (by Benjamin Keen)
http://www.benjaminkeen.com/software/smartlists/prototype/
- Quicksand - jQuery Plugin (by @razorjack)
http://razorjack.net/quicksand/
- Few more mosaic components to organize elements using animations.
The plugin was designed as a very basic plugin to handle listing, and on top of it, you can add more features, like Quicksand effects based on YUI Anim, etc.
The supporting version is marked as 3.0, but it requires some new features from YUI 3.1 (or on development head from github prior to the release).
In this example, we plug the smart listing plugin into a node (in this case an UL element), and we apply certain filtering:
1- when a user click on an element with id = buttondisplayall, the list of elements should be refreshed, displaying all the elements
2- when a user click on an element with id = buttondisplayapps, the list of elements should be refreshed, displaying only elements with data-type = app
3- when a user click on an element with id = buttondisplayutils, the list of elements should be refreshed, displaying only elements with a classname = util
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2010.03.11-21'
}).use('event', 'node', 'gallery-smart-list', function(Y) {
Y.one("#applications").plug(Y.Plugin.SmartList, {
selector: 'li'
});
mylist = Y.one("#applications").smartlist;
Y.one('#buttondisplayall').on('click', function(e) {
mylist.set('filter', ''); // setting filter to empty
});
Y.one('#buttondisplayapps').on('click', function(e) {
mylist.set('filter', 'li[data-type=app]'); // setting the filter to display elements with data-type = app
});
Y.one('#buttondisplayutils').on('click', function(e) {
mylist.set('filter', 'li[class=util]'); // setting the filter to display elements with class util
});
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info