I just started from this (nice post)[https://gist.github.com/justinwoo/08f9f8fcdcf865025f18] so I downloaded (this repo)[https://github.com/justinwoo/react-rxjs-flow/tree/each-intent-subject] and translate it for (Ractive)[http://www.ractivejs.org/]
- (justinwoo)[https://gist.github.com/justinwoo]
(https://github.com/iroy2000/react-reflux-boilerplate-with-webpack) (nodejs/node-gyp#629) (kriasoft/react-starter-kit#22) (https://ochronus.com/react-reflux-example/)
This branch is in turn based off of https://github.com/justinwoo/react-rxjs-flow/tree/dynamic-width-scroll-table, and has more featuers and still ends up combining the multiple features together by combining relevant streams.
let columns$ = Rx.Observable.just(['ID (fixed width)', 'ID * 10', 'Random Number']);
let defaultColumnWidths$ = Rx.Observable.just([300, null, null]);
let tableHeight$ = Rx.Observable.just(500);
let rowHeight$ = Rx.Observable.just(30);
let rowCount$ = Rx.Observable.just(10000);
let scrollTop$ = actions.scrollTop$.startWith(0);
let visibleIndices$ = makeVisibleIndices$(
tableHeight$, rowHeight$, rowCount$, scrollTop$
);
let containerWidth$ = actions.containerWidth$.startWith(window.innerWidth);
let columnWidths$ = makeColumnWidths$(
defaultColumnWidths$,
containerWidth$
);
let columnSort$ = actions.columnSort$.startWith(defaultColumnSort);
let filterEvenRows$ = actions.filterEvenRows$.startWith(false);
// Actually load data in
let tableData$ = actions.tableData$.startWith(defaultTableData);
let columns$ = tableData$.map(data => data.columns);
let defaultColumnWidths$ = tableData$.map(data => data.defaultColumnWidths);
// Row data is mapped from the table data stream
let rawRows$ = tableData$.map(data => data.rows);
// Sort rows with information about how columns are sorted
let sortedRows$ = makeSortedRows$(rawRows$, columnSort$);
// Then we take that to filter the rows by criteria
// In this case whether filtering by even-numbered ids or not
let rows$ = makeFilteredRows$(sortedRows$, filterEvenRows$);
let rowCount$ = rows$.map(rows => rows.length);
let tableHeight$ = Rx.Observable.just(500);
let rowHeight$ = Rx.Observable.just(30);
let scrollTop$ = actions.scrollTop$.startWith(0);
let visibleIndices$ = makeVisibleIndices$(
tableHeight$, rowHeight$, rowCount$, scrollTop$
);
let containerWidth$ = actions.containerWidth$.startWith(window.innerWidth);
let columnWidths$ = makeColumnWidths$(
defaultColumnWidths$,
containerWidth$
);