-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add autodividers functionality for listviews #2851
Conversation
Can be used to autogenerate dividers for a listview by setting data-autodividers="alpha" (dividers are unique, uppercased single characters from list items) or data-autodividers="full" (unique full text strings selected from list items) on the ul element of the listview. It's also possible to apply a custom selector to find the elements to be used for divider text, with data-autodividers-selector="...". This relates to #2466, but is a different implementation which will automatically update the list dividers if the list elements change. It also has a fairly thorough test suite and documentation.
@@ -4,7 +4,7 @@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, my editor has corrected some of the whitespace in this file.
Thanks for the pull request. A couple quick notes:
At a quick glance this does appear useful though and it's built in such a way that people should be able to drop this into their applications pretty easily. Have you considered blogging about this or posting it to the jquery plugins page? |
On Wed, Oct 26, 2011 at 6:23 PM, John Bender <
Thanks for the review, much appreciated. The issue for me is that I have permission to contribute to jQuery (the I'll have a think about the best way forward from here. Cheers.
|
Thanks again Elliot. I think this might be worth adding after 1.0 but I wonder if this could be packaged as an extension to listview filter so if you add this script, you get this feature? We're heading int eh direction of keeping widgets simple and using extensions. Filer itself is an extension of listview. |
I have a slightly updated version of this at https://github.com/townxelliot/jquery-mobile/tree/autodividers. This incorporates the tests and docs into the jQuery Mobile ones. This is also available in the web-ui-fw project I've been working on with colleagues at Intel (which is now open source): https://github.com/web-ui-fw/web-ui-fw. There, autodividers is integrated with our demos, tests and docs. I'd like to hear whether you're interested in this for core (I can raise a formal pull request), or whether I should just maintain it as part of our project (the project is now more of a series of plugins for jQuery Mobile than it was before, and we've accentuated that angle in the README). In reply to Todd's comments above, this will work with or without a listview filter, so I think it should be an extension of listview, rather than listview filter. Unless I've misunderstood the question. |
@townxelliot - First off, all the stuff you guys are doing is great and we should coordinate more on what you're doing and how to bring things in or at least package them for easy consumption. Mind shooting me and email at todd [at] filamentgroup.com? We've actually pulled in a version of the popup script that gabriel posted a while back and are refining it for inclusion, maybe at 1.1. For the auto-divider, I agree that this would make sense as an extension to listview. If you want to prepare that as a pull request, we can take a look and decide whether now if a good time to pull this in. |
Please see #3302 for the updated pull request, which better separates the changes into different categories. |
Can be used to autogenerate dividers for a listview by
setting data-autodividers="alpha" (dividers are unique,
uppercased single characters from list items) or
data-autodividers="full" (unique full text strings selected
from list items) on the ul element of the listview.
It's also possible to apply a custom selector to find the
elements to be used for divider text, with
data-autodividers-selector="...".
This relates to #2466,
but is a different implementation which will automatically
update the list dividers if the list elements change. It also
has a fairly thorough test suite and documentation.