Skip to content

Commit e426025

Browse files
committed
The IDs returned by getTableCellID now correspond to mwTextField objs
This means that the style loss on resize is no longer an issue. + Small fix for the previous commit (coding style). TODO: add `getTableCellID` to API documentation.
1 parent 162af02 commit e426025

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mlapptools.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,13 @@ function fontWeight(uiElement, weight)
252252
idc = strcat(CELL_ID_PREFIX, num2str(idx(:)));
253253
% Preallocation:
254254
ID_obj(nR,1) = WidgetID;
255+
% Get the window handle so we could execute some JS commands:
256+
hWin = mlapptools.getWebWindow(hTable);
255257
% ID array population:
256258
for indI = 1:numel(idx)
257-
ID_obj(indI) = WidgetID(mlapptools.DEF_ID_ATTRIBUTE, idc{indI} );
259+
jsCommand = sprintf('dojo.byId(%s).childNodes[0].id', idc{indI});
260+
textFieldID = hWin.executeJS(jsCommand);
261+
ID_obj(indI) = WidgetID(mlapptools.DEF_ID_ATTRIBUTE, textFieldID(2:end-1) );
258262
end
259263
end % getTableCellID
260264

@@ -278,15 +282,16 @@ function fontWeight(uiElement, weight)
278282
case {'uipanel','figure','uitabgroup','uitab'}
279283
widgetID = WidgetID('data-tag', mlapptools.getDataTag(uiElement));
280284
case 'uitable'
285+
TAB_PREFIX = "mgg_";
281286
% uitables are inconsistent with other elements, their id always starts with
282287
% "mgg_". So we list all widgets and select the "table-suspects" among them.
283288
% Note: the listing is not really necessary, as it is possible to search for
284289
% nodes having a property that starts with a certain string: E[foo^="bar"]
285290
% web(['http://dojotoolkit.org/reference-guide/1.10/dojo/query.html',...
286291
% '#additional-selectors-supported-by-lite-engine'], '-browser');
287292
[~,tmp] = mlapptools.getWidgetList( ancestor(uiElement,'figure') );
288-
widgetID = arrayfun(@(x)WidgetID('id',x), ...
289-
string(tmp.id(contains(tmp.id, "mgg_"))));
293+
widgetID = arrayfun(@(x)WidgetID(mlapptools.DEF_ID_ATTRIBUTE, x), ...
294+
string(tmp.id(contains(tmp.id, TAB_PREFIX))));
290295
otherwise % default:
291296
widgetID = mlapptools.getWidgetID(win, mlapptools.getDataTag(uiElement));
292297
end

0 commit comments

Comments
 (0)