App Designer: uitable to behave like uitree with checkboxes

조회 수: 3 (최근 30일)
NS
NS 2022년 5월 5일
편집: Rahul 2025년 5월 8일
Is there a native way in App Designer to make the uitable (or equivalent) look and feel like a uitree with checkboxes, so it can expand and collapse sections of the uitable (see image below)? Made up example: if one of the top nodes is fruit, I want to expand the node to show various fruits (apple, banana, etc) along with specific associated information in the table like quantity, sales price, quantity on order, etc. Then have the checkboxes to select all or none in the top node and the checkboxes for the individual fruit rows. The other top nodes would follow.
I would prefer not to use a 3rd party tool to work with matlab as it may complicate the compiler's abilities down the road if I need it. thanks.

답변 (1개)

Rahul
Rahul 2025년 5월 8일
편집: Rahul 2025년 5월 8일
Hi @NS,
While this functionality is not natively present in MATLAB currently, you can consider using 'uicheckboxes' inside a 'uitable' component along with setting a 'cellEdit' callback on the 'uitable'. Inside the 'cellEdit' callback you can add code for adding subrows below the row in which the checkbox is selected. You can remove the sub row when the checkbox gets unselected.
While this would not look equivalent to a 'uitree' component which would have a heirarchy to rows, but it would give the desired functionality of obtaining subrows.
I have attached an mlapp file for reference.
Thanks.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by