javascript - Getting pagination to work with React Komposer -
i'm using meteor 1.3.4.1, kurounin:pagination 1.0.9, , react-komposer 1.8.0 (npm package).
so here's code instantiating pagination within composer function:
function composer(props, ondata) { console.log('loading pages'); const pagination = new meteor.pagination(ufcfighters); if( pagination.ready() ) { console.log('ready'); const fighters = { columns: [ { width: '5%', label: '', classname: '' }, { width: '20%', label: 'name', classname: 'text-center' }, { width: '20%', label: 'wins/losses/draws', classname: 'text-center' }, { width: '20%', label: 'weight class', classname: 'text-center' }, { width: '10%', label: 'status', classname: 'text-center' }, { width: '10%', label: 'rank', classname: 'text-center' }, ], data: pagination.getpage(), }; ondata(null, { fighters, pagination }); } };
is proper use react komposer? noticed pagination load subscription , never ready present data. console output 'loading pages' repeatedly, never says 'ready'.
any advice appreciated.
looks pretty me, think need return if pagination not ready.
function composer(props, ondata) { const pagination = new meteor.pagination(ufcfighters); if(!pagination.ready()) { return; } const fighters = { columns: [ { width: '5%', label: '', classname: '' }, { width: '20%', label: 'name', classname: 'text-center' }, { width: '20%', label: 'wins/losses/draws', classname: 'text-center' }, { width: '20%', label: 'weight class', classname: 'text-center' }, { width: '10%', label: 'status', classname: 'text-center' }, { width: '10%', label: 'rank', classname: 'text-center' }, ], data: pagination.getpage(), }; ondata(null, { fighters, pagination }); };
Comments
Post a Comment