You can find a working example here.
You'll notice that all the top level sorts work, except for the sort by "First Name" or "Last Name"...
Here's a code snippet from what I've done so far...
<div class="option-combo shape">
<h3>By First Name or Last Name</h3>
<ul id="sort-by" class="option-set clearfix" data-option-key="sortBy">
<li><a href="#sortBy=original-order" data-option-value="original-order" class="selected" data>All Employees</a></li>
<li><a href="#sortBy=first" data-option-value="first">First Name</a></li>
<li><a href="#sortBy=last" data-option-value="last">Last Name</a></li>
</ul>
I've made some progress so far...
Currently, the code below is commented out. If I remove the comment, then I am able to sort, but only by last name. Additionally, when this is enabled, the other sorts will no longer work and I can't seem to make them cohesive.
<!-- Allows for sort by last name -->
var $optionSets = $('#options .option-set'),
$optionLinks = $optionSets.find('a');
$optionLinks.click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
return false;
}
var $optionSet = $this.parents('.option-set');
$optionSet.find('.selected').removeClass('selected');
$this.addClass('selected');
// make option object dynamically, i.e. { filter: '.my-filter-class' }
var options = {},
key = $optionSet.attr('data-option-key'),
value = $this.attr('data-option-value');
// parse 'false' as false boolean
value = value === 'false' ? false : value;
options[ key ] = value;
if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
// changes in layout modes need extra logic
changeLayoutMode( $this, options )
} else {
// otherwise, apply new options
$container.isotope( options );
}
return false;
});
Your assistance is greatly appreciated!