Revert of adjustRowHeight

Hello webix friends.

I have a datatable which will be show all rowsLineheight: 18.
On a clickevent I call $(tableName).adjustRowHeight(‘content’);
content is the column name.
But all rows of this column will be expanded.

  1. Is there a way to expand the column only of a specific row???

  2. Can I revert the expandation to the maxRowHeight right before I call the adjustRowHeight???

Please help me
Thank you so much…

Michael

Hello Michael,

  1. Is there a way to expand the column only of a specific row???

To expand the column of a specific row first you need to get the width of cells without paddings and rowLineHeight:

const cell = { row: 3, column: "title" };
const item = this.getItem(cell.row)
const config = this.getColumnConfig(cell.column);
const width = config.width - webix.skin.$active.dataPadding*2;
const lineHeight = this.config.rowLineHeight;

Then we get raw width of a text in a specific cell (getText, webix.html.getTextSize)
to calculate the height that we need for this cell:

const cellContent = this.getText(cell.row, cell.column);
const size = webix.html.getTextSize(cellContent, "webix_table_cell");
const cellHeight = lineHeight*Math.ceil(size.width/width);
  1. Can I revert the expandation to the maxRowHeight right before I call the adjustRowHeight???

To revert the expandation to the maxRowHeight of only one row you need to get it from the config of the table and set it with the help of method setRowHeight:

const table = $$("table");
const rowHeight =  table.config.rowHeight;
const maxRowHeight = table.config.maxRowHeight;
const height = maxRowHeight || rowHeight;
table.setRowHeight(3, height)

Please take a look at the example: Code Snippet

But note if you want, for example, to revert the expandation of several rows in the table or expand several rows (using loop) it will be rather expansive operation. For this case it is be better to assign $height to all the rows you need in a loop and after that refresh the table:

item.$height = cellHeight;
this.refresh();

Thank you for the detailed description. I will take a look at it and let you know if it works.

Michael