Skip to content

Instantly share code, notes, and snippets.

@engineersamuel
Created January 5, 2016 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save engineersamuel/0dce908f179e4cd5732c to your computer and use it in GitHub Desktop.
Save engineersamuel/0dce908f179e4cd5732c to your computer and use it in GitHub Desktop.
constructor
constructor(props, context) {
super(props, context);
// Copied from http://codepen.io/desandro/pen/nFrte
this.filterFns = {
// show if number is greater than 50
numberGreaterThan50: function () {
var number = $(this).find('.number').text();
return parseInt( number, 10 ) > 50;
},
// show if name ends with -ium
ium: function () {
var name = $(this).find('.name').text();
return name.match( /ium$/ );
}
};
this.isoOptions = {
itemSelector: '.element-item',
layoutMode: 'masonry',
masonry: {
// Using a sizer element is necessary to prevent a vertical collapse between data loads
// Ex. load all, then load metal, the metal will collapse into a vertical layout if this masonry: {}
// section is commented out.
columnWidth: '.element-item-sizer'
},
//sortBy: 'name', // If you want to set the default sort, do that here.
getSortData: {
name: '.name',
symbol: '.symbol',
number: '.number parseInt',
category: '[data-category]',
weight: function( itemElem ) {
var weight = $( itemElem ).find('.weight').text();
return parseFloat( weight.replace( /[\(\)]/g, '') );
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment