Created
January 5, 2016 21:43
-
-
Save engineersamuel/0dce908f179e4cd5732c to your computer and use it in GitHub Desktop.
constructor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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