React data grid React数据网格并不总是在最后几列上显示值
我的屏幕越小,没有值的列就越多。只要我手动调整屏幕的宽度(通过将其拉大或拉小),所有的值都会显示出来。这好像是一个错误。我附上了两张照片,显示了html如何在相邻单元格中显示,有值和无值显示 |React data grid React数据网格并不总是在最后几列上显示值,react-data-grid,React Data Grid,我的屏幕越小,没有值的列就越多。只要我手动调整屏幕的宽度(通过将其拉大或拉小),所有的值都会显示出来。这好像是一个错误。我附上了两张照片,显示了html如何在相邻单元格中显示,有值和无值显示 | 我们找到的解决方案是将minColumnWidth:10添加到gridProps getGridProps: -> { budgets } = @props.profile rowHeight = headerHeight = 35 extraHeightToPreven
我们找到的解决方案是将minColumnWidth:10添加到gridProps
getGridProps: ->
{ budgets } = @props.profile
rowHeight = headerHeight = 35
extraHeightToPreventScrollBar = 10
rowsCount = budgets?.length ? 0
columns: @getColumns()
rowGetter: (i) =>
budgetRows = @getBudgetRows()
budgetRows[i]
rowsCount: rowsCount
minHeight: rowsCount * rowHeight + headerHeight + extraHeightToPreventScrollBar
enableCellSelect: not @state.tableDisabled
onGridRowsUpdated: @handleGridRowsUpdated
getColumns: ->
cols = [{ key: 'year', name: 'Year', editable: false, width: 70 }]
for month in MONTHS
cols.push
key: month
name: month
editable: not @state.tableDisabled
formatter: FormattedCell
cols.push
key: 'total'
name: 'Total'
editable: false
formatter: FormattedCell
cols.push
key: 'trash'
name: ''
editable: false
formatter: getTrashCan @removeBudget, @state.tableDisabled
width: 50
cols
getBudgetRows: ->
{ budgets } = @props.profile
_.map budgets, (monthlyBudgets) ->
row = { year: monthlyBudgets.year }
for month, monthIdx in MONTHS
row[month] = monthlyBudgets.budgets[monthIdx] ? '' # ReactDataGrid cannot take null, convert to ''
row.total = Util.getBudgetsTotal monthlyBudgets ? ''
row.trash = monthlyBudgets.year
row