【问题标题】:Columncount in multigrid not working!! React virtualized多网格中的列数不起作用!反应虚拟化
【发布时间】:2022-01-10 16:40:23
【问题描述】:

我已将 columncount 设置为 3 到 props,但只呈现一列。

我的方法对吗?

render() {
        const {
            rowData,
            columnCount,
            columnMinWidth,
            maxHeight,
            rowHeight,
           
        } = this.props;

        const gridHeight = (rowData.length * rowHeight > maxHeight) ? maxHeight : ((rowData.length * rowHeight) + 20);
        return (
            <AutoSizer disableHeight>
                {({ width }) => {
                    return (
                        <ColumnSizer
                            columnMaxWidth={width}
                            columnMinWidth={columnMinWidth}
                            columnCount={columnCount}
                            width={width/columnCount}
                        >
                            {({  columnWidth, registerChild }) => (
                                <MultiGrid
                                    cellRenderer={({
                                        columnIndex, key, rowIndex,
                                        }) => (
                                            <VirtualTableCell
                                                columnIndex={columnIndex}
                                                key={key}
                                                rowIndex={rowIndex}
                                                rowData={rowData}
                                            />
                                        )} 
                                    ref={registerChild}
                                    columnWidth={columnWidth}
                                    columnCount={columnCount}
                                    height={gridHeight}
                                    rowHeight={150}
                                    rowCount={rowData.length}
                                    width={width}
                                />
                            )
                            }
                        </ColumnSizer>
                    );
                }}
            </AutoSizer>
        );
    }

【问题讨论】:

    标签: reactjs react-virtualized


    【解决方案1】:

    我需要将我从 cellrenderer 道具中获得的每个单元格的样式添加到通过此函数呈现的单元格中

    【讨论】:

      猜你喜欢
      • 2018-01-22
      • 2018-03-04
      • 2018-01-06
      • 2017-01-06
      • 2017-12-03
      • 2019-10-08
      • 2020-03-24
      • 1970-01-01
      • 2019-03-09
      相关资源
      最近更新 更多