Widgets Toolbox jTable cell value issue

Hi, I have 2 tables created using widgets toolbox table function. When I click on a cell value on first table and move to the second table cell, the value on the first table cell automatically changes to the value of the cell from the 2nd table. Following code section demonstrates the issue. Wondering if anyone has run into this issue and if there is a fix for this. The table function works fine as long as there is only a single table.
f1 = figure(...
'Toolbar','none',...
'MenuBar','none',...
'NumberTitle','off',...
'Units','pixels',...
'Position',[100 100 880 200]);
movegui(f1,[100 -100])
f2 = figure(...
'Toolbar','none',...
'MenuBar','none',...
'NumberTitle','off',...
'Units','pixels',...
'Position',[100 100 880 200]);
movegui(f2,[100 -500])
w1 = uiw.widget.Table(...
'Parent',f1,...
'CellEditCallback',@(h,e)disp(e),...
'CellSelectionCallback',@(h,e)disp(e),...
'ColumnName',{'A','B','C'},...
'Label','Table1:', ...
'LabelLocation','top',...
'LabelHeight',18,...
'Units','normalized', ...
'Position',[0 0 1 1]);
w1.Data = magic(3);
w2 = uiw.widget.Table(...
'Parent',f2,...
'CellEditCallback',@(h,e)disp(e),...
'CellSelectionCallback',@(h,e)disp(e),...
'ColumnName',{'A','B','C'},...
'Label','Table2:', ...
'LabelLocation','top',...
'LabelHeight',18,...
'Units','normalized', ...
'Position',[0 0 1 1]);
w2.Data = magic(3);

댓글 수: 4

Robyn Jackey
Robyn Jackey 2020년 4월 28일
It is likely due to an optimization where table columns of the same type are reusing the same Java editor. Can you try commenting out a few lines of uiw.enum.TableColumnFormat - lines 294 and 311-313:
pk68
pk68 2020년 4월 28일
Thanks Robyn. The changes seem to address the issue
pk68
pk68 2020년 4월 28일
With more testing, I am running into an issue if any of the columns in the table is of Popup Editor type. The change no longer allows to drop down the Popup list.
Here is the code section with first column being a Popup. When those 3 lines are commented out, dropdown option stops working
f1 = figure(...
'Toolbar','none',...
'MenuBar','none',...
'NumberTitle','off',...
'Units','pixels',...
'Position',[100 100 880 200]);
movegui(f1,[100 -100])
w1 = uiw.widget.Table(...
'Parent',f1,...
'CellEditCallback',@(a,b)disp(b),...
'CellSelectionCallback',@(a,b)disp(b),...
'ColumnName',{'A','B','C'},...
'ColumnFormat',{'popup','numeric','numeric'},...
'Label','Table1:', ...
'LabelLocation','top',...
'LabelHeight',18,...
'Units','normalized', ...
'Position',[0 0 1 1]);
w1.Data = magic(3);
w2 = uiw.widget.Table(...
'Parent',f2,...
'CellEditCallback',@(h,e)disp(e),...
'CellSelectionCallback',@(h,e)disp(e),...
'ColumnName',{'A','B','C'},...
'ColumnFormat',{'popup','numeric','numeric'},...
'Label','Table2:', ...
'LabelLocation','top',...
'LabelHeight',18,...
'Units','normalized', ...
'Position',[0 0 1 1]);
f2 = figure(...
'Toolbar','none',...
'MenuBar','none',...
'NumberTitle','off',...
'Units','pixels',...
'Position',[100 100 880 200]);
movegui(f2,[100 -500])
w2.Data = magic(3);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Verification, Validation, and Test에 대해 자세히 알아보기

제품

릴리스

R2017a

질문:

2020년 4월 27일

댓글:

2020년 4월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by