2017-06-22 35 views
0

我的屏幕尺寸越小,列越不會有值。只要我手動調整屏幕寬度(通過拖大或縮小),所有值都會顯示出來。這看起來像一個錯誤。我附上了2張照片,展示了html如何在具有值且沒有顯示值的相鄰單元上顯示。React數據網格並不總是顯示最後幾列的值

One cell showing value the next not showing value | Before I drag the window size

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 

回答

0

我們找到了一個解決方案是添加minColumnWidth:10到gridProps

相關問題