A demo that implements a sortable table component using Facebook's React.
Features:
- Remote data loading
- Sortable columns
- Filterable columns
- Repeatable headers
var CONFIG = {
sort: { column: "col2", order: "desc" },
columns: {
col1: { name: "Col1", filterText: "", defaultSortOrder: "desc"},
col2: { name: "Col2", filterText: "", defaultSortOrder: "desc"},
col3: { name: "Col3", filterText: "", defaultSortOrder: "desc"}
}
};
React.renderComponent(<TableSorter dataSource="/api/data.json" config={CONFIG} headerRepeat="5" />, document.getElementById("table-sorter"));
The demo uses an in-browser JSX Transformer; therfore, the code cannot be run without a web server (or your browser will complain that "Cross origin requests are only supported for HTTP").
node-static is a quick solution.
npm install -g node-static
static
And now view at: http://localhost:8080/.