react-virtualized

How to measure a rows height in react-virtualized list

淺唱寂寞╮ 提交于 2019-12-23 10:05:51
问题 I'm a little uncertain as how to achieve dynamic heights of a List using react-virtualized. I have a component as follows: import { List } from 'react-virtualized'; <List height={400} rowCount={_.size(messages)} rowHeight={(index) => { return 100; // This needs to measure the dom. }} rowRenderer={({ key, index, style }) => <Message style={style} {...messages[index]} />}} width={300} /> I have looked at using CellMeasurer as per the docs which says it can be used with the List component but I

_isRowLoaded and _loadMoreRows not getting called react virtualized

此生再无相见时 提交于 2019-12-23 04:37:33
问题 My _loadMoreRows and _isRowLoaded are not getting called, so loadedRowsMap remains empty and I am unable to identify the rows loaded to avoid making HTTP request . Here's my complete code : import React, { Component } from 'react'; import { connect } from 'react-redux'; import {formatDate} from '../../helper/date'; import { recentActivitiAction } from '../actions/dashboardAction'; import { BeatLoader } from 'react-spinners'; import {AutoSizer, List, CellMeasurer, InfiniteLoader,

How to add sorting to table with react virtualized?

走远了吗. 提交于 2019-12-22 08:26:16
问题 I am trying to add sorting to my project with the table sorting demo on Github. My code: import React from 'react'; import PropTypes from 'prop-types'; import { Table, Column, SortDirection, SortIndicator } from 'react-virtualized'; import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer'; import 'react-virtualized/styles.css'; class NewTable extends React.Component { constructor(props) { super(props); this.dataList = props.list; this.state = { headerHeight: 50, rowHeight: 25,

Which parts of react-virtualized package I need?

耗尽温柔 提交于 2019-12-13 07:28:37
问题 I want to make infinite scroll page with image grid. Which parts of react-virtualized package I need? InfiniteLoader and WindowScroller and Masonry ? And how define limit of records in query when I scroll window. 回答1: WindowScroller works with the Masonry component but InfiniteLoader only works with Grid and List . (The docs mention this.) And how define limit of records in query when I scroll window. This question isn't really clear. Perhaps you should try something and then post a new

Trying to combine an API request with a grid rendering

末鹿安然 提交于 2019-12-11 17:28:09
问题 So I've got both chunks of code written for both the API request, as well as the grid rendering, however I'm confused as to how to combine the two in a react environment. Any suggestions? (this is using react-axios) <Request method="get", /* get, delete, head, post, put and patch - required */ url="http://coincap.io/front", /* url endpoint to be requested - required */ debounce={50} /* minimum time between requests events - optional */ onSuccess={(response)=>{}} /* called on success of axios

react-virtualized notification when List gets focus

ぃ、小莉子 提交于 2019-12-11 06:13:29
问题 When a user tabs into a List and the List gets focus I want to put a border around the List's parent. It would be great if I could call onFocus/onBlur on the List. Any advice? 回答1: Currently there is no way to attach onBlur or onFocus events (or anything other than onScroll ) to a Grid . (The same is true for List which just decorates a Grid ). You could add this behavior yourself using the ref though. Here is an example Plnkr: https://plnkr.co/edit/TVxnhf?p=preview The key part is:

Add padding-top in react-virtualized <List />

余生长醉 提交于 2019-12-11 05:50:45
问题 I have a <List /> component where I want to add an initial padding-top to the wrapper . Since all the elements are absolute positioned I found this solution but I wonder if it's right or is there another solution less expensive: const rowRenderer = ({ index, key, style, isScrolling }) => { // ... return ( <ul key={key} style={{ ...style, top: style.top + 50, }}> { items.map(itemRenderer) } </ul> ) } The related part is the style prop. 回答1: You can avoid the unnecessary object-creation and

React Virtualized - how to scroll to div within row with dynamic height

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 22:35:05
问题 I'm using RV List to load a large document with custom formatting. It has worked like a charm, but I am running into the following 2 issues: I currently set up a list within a cellmeasurer based on this to calculate the dynamic heights of rows (width is fixed). I managed to use scrollToindex to find the row I want, but some rows are quite large and I want to be able to scroll to a specific place within the row. I understand that I need to use scrollTop to do so, but I don't know how to get

react-virtualized InfiniteLoader/List - working example using AJAX

天大地大妈咪最大 提交于 2019-12-10 21:09:34
问题 I'm doing a React/Redux project, and need to implement a virtualized/infinite-loading list. react-virtualized seems intended to do the job, but even after reading all of the available docs and reading a number of StackOverflow posts, I haven't been able to get it working or found a clear explanation of the mechanics of how the components actually work. The primary examples I've looked at are: https://github.com/bvaughn/react-virtualized/blob/master/docs/creatingAnInfiniteLoadingList.md https:

How do I tell the Masonry component that its cells have changed their height?

喜欢而已 提交于 2019-12-10 17:48:46
问题 I have a react component that displays a one-dimensional list of items in a grid pattern. Every item has the same width and height, and they are located within three columns. There can be a lot of these, so I decided to give react-virtualized a whirl, using the Masonry component, which seems to have been written for precisely this use case. It works well, but for one caveat: If the items change their height, I cannot get Masonry to notice. Here's a reduced example: constructor(props) { [...]