Auto resizing rows for uitable with multiline cells

I'm trying to create a uitable that has some rows containing multiline cells and have these resize automatically. I've had some success using Yair Altman's findjobj.m function using the code below:
f = figure('Position', [100 100 752 250]);
data = {'<html><center />Coefficient<br />of elasticity</html>' 'bravo' 'charlie'; 'delta' 'echo' 'foxtrot'};
cols = {'Test1' 'Test2' 'Test3' 'Test4' 'Test5' 'Test6'};
mtable = uitable('Parent', f, 'Position', [25 50 700 200], 'ColumnName', cols, 'Data', data)
import com.jidesoft.grid.*
jscroll = findjobj(mtable);
jtable = jscroll.getViewport.getView;
jtable.setRowAutoResizes(true);
%jtable.setRowResizable(true);
This creates a table that looks like this:
My main problem is that if I resize the figure, the row heights are immediately reset. Is there a way that I can stop this from happening?
A secondary issue is that the height of the row headers don't match the cells, although if I uncomment the setRowResizable line in my code and resize the rows manually the row headers are modified correctly. How can I make this happen automatically?

3 件のコメント

Dustin
Dustin 2018 年 7 月 13 日
Hello, did you find a solution to your problem? I am having the same issue.
Lockywolf
Lockywolf 2020 年 2 月 25 日
2020, same problem
Franziska Reiner
Franziska Reiner 2020 年 8 月 18 日
The problem of changing row high when resizing the figure can be solved by adjusting the column width manually after this happened.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

タグ

質問済み:

2016 年 3 月 11 日

コメント済み:

2020 年 8 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by