Last active
October 31, 2015 03:03
-
-
Save tilomitra/923e75f29e63592c05a7 to your computer and use it in GitHub Desktop.
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
// Get all applications from the applicationList store | |
exports.allApplications = ['applicationList']; | |
// Get the search term from the searchTerm Store | |
exports.searchTerm = ['searchTerm']; | |
// Create a getter called filteredApplicationList, that takes | |
// the above two stores, filters the appList against the search | |
// query, and returns the result. | |
exports.filteredApplicationList = [ | |
exports.allApplications, | |
exports.searchTerm, | |
(allApps, searchTerm) => { | |
var list = allApps; | |
if (searchTerm) { | |
list = allApps.filter(app => { | |
return (app.get('name').indexOf(searchTerm) !== -1) | |
}); | |
} | |
return list; | |
} | |
] |
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
var AppList = require('./path/to/AppList'); | |
var GridView = React.createClass({ | |
mixins: [flux.ReactMixin], | |
getDataBindings() { | |
return { | |
filteredApplicationList: AppList.getters.filteredApplicationList, | |
}; | |
}, | |
render() { | |
return ( | |
<section className="grid-view"> | |
// Look at this.state.filteredApplicationList array and construct a grid view | |
</section> | |
); | |
} | |
}); | |
module.exports = GridView; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment