walkframe / gridsheet

Spreadsheet component for React
https://docs.walkframe.com/gridsheet/react
Apache License 2.0
172 stars 12 forks source link

Auto adjust height of the row #57

Closed Abdulrehmanharisdev closed 1 month ago

Abdulrehmanharisdev commented 2 months ago

Description

is there any way to adjust the row height automaticly according to content of the cell?

Reproduction URL

No response

righ commented 2 months ago

Thank you for your comment.

There is no option that automatically adjusts the height, but this may be achieved by using options.onSave. Since onSave accepts (table, position), you can get {[address]: Cell} by writing the following.

const diff = table.getObjectFlatten({
  filter: (cell) =>
    ! !cell?.changedAt &&
    cell.changedAt > table.lastChangedAt!
});

For example, you could get the number of rows from Cell.value and multiply by line-height to determine the height. Or you could get the HTML height by identifying the HTML element td[data-address="${address}"] .gs-cell-rendered from position. This might be applied like table.update({diff: {[y]: {height}}, partial: true}) to change the height.

Please give it a try.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.