Googled around a fair bit but couldn't wrap my head around how to deal with this problem.
I have/plan a list of items.
var list1 = [
[141,'AAA', 'A Group'],
[262,'BBB', 'B Group'],
[345,'CCC', 'B Group'],
[136,'DDD'],
[095,'EEE', 'A Group'],
[175,'FFF'], and so on...
];
My goal is to print these items. Groups first, in alphabetical. Groupless after that.
All items in alphabetical.
Final result would be something like:
<div>
<h2>A Group</h2>
<ul class="group">
<li>
<img src="/141">
<h3>AAA</h3>
</li>
<li>
<img src="/095">
<h3>EEE</h3>
</li>
</ul>
<h2>B Group</h2>
<ul class="group">
<li>
<img src="/262">
<h3>BBB</h3>
</li>
<li>
<img src="/345">
<h3>CCC</h3>
</li>
</ul>
<h2>No group</h2>
<ul class="non-group">
<li>
<img src="/136">
<h3>DDD</h3>
</li>
<li>
<img src="/175">
<h3>FFF</h3>
</li>
</ul>
</div>
Any thoughts on how to tackle this?
Found this, https://stackoverflow.com/a/7596924/543365
Fairly close to what I could use. Couldn't manage to bend it to my use though.