Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append function to group JSON list alphanumeric #173

Open
orionseye opened this issue Jan 21, 2020 · 0 comments
Open

append function to group JSON list alphanumeric #173

orionseye opened this issue Jan 21, 2020 · 0 comments

Comments

@orionseye
Copy link

orionseye commented Jan 21, 2020

What's the proper way to append a function which groups (large) data alphanumeric, on each scroll? I tired with .append() but had no luck

Output would be something like:
A
aaa
B
bbb
..etc

Current setup

<div id="scrollArea" class="clusterize-scroll">
<ul id="contentArea" class="clusterize-content">

...
and do something like:

$('#contentArea > li').each(function () {
  var letter = $('a', this).text().charAt(0);
  
  if (!$(this).parent().find('[data-letter="'+ letter +'"]').length) {
    $(this).parent().append('<div data-letter="'+ letter+'"><span><b>'+ letter +'</b></span></div>');
  }
  $(this).parent().find('[data-letter="'+ letter +'"]').append(this);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant