Skip to content

Commit 162af02

Browse files
committed
Getting the widgetID of a uitable is now possible.
..although it isn't terribly useful. The main usefulness is likely for traversing the DOM (getting to parents / children of this id). Perhaps in the future we'll return a more useful WidgetID for uitables.
1 parent 8daf390 commit 162af02

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mlapptools.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ function fontWeight(uiElement, weight)
277277
warning(warnState); % Restore warning state
278278
case {'uipanel','figure','uitabgroup','uitab'}
279279
widgetID = WidgetID('data-tag', mlapptools.getDataTag(uiElement));
280+
case 'uitable'
281+
% uitables are inconsistent with other elements, their id always starts with
282+
% "mgg_". So we list all widgets and select the "table-suspects" among them.
283+
% Note: the listing is not really necessary, as it is possible to search for
284+
% nodes having a property that starts with a certain string: E[foo^="bar"]
285+
% web(['http://dojotoolkit.org/reference-guide/1.10/dojo/query.html',...
286+
% '#additional-selectors-supported-by-lite-engine'], '-browser');
287+
[~,tmp] = mlapptools.getWidgetList( ancestor(uiElement,'figure') );
288+
widgetID = arrayfun(@(x)WidgetID('id',x), ...
289+
string(tmp.id(contains(tmp.id, "mgg_"))));
280290
otherwise % default:
281291
widgetID = mlapptools.getWidgetID(win, mlapptools.getDataTag(uiElement));
282292
end

0 commit comments

Comments
 (0)