How to select all component inside a group?

How to select all components inside a group programmatically?
If we select a group and press “CTRL + A” then all component(Node & link) inside that group should be selected.
Is there any example like this?

You will need to override the CommandHandler.selectAll command so that it behaves differently based on what is selected at that time. You will need to decide what to do when both a regular Node and a Group are selected, or when multiple Groups are selected.

In your override method, when you do not call the super method, before selecting or deselecting any Part call:

diagram.raiseDiagramEvent('ChangingSelection');

Afterwards, call:

diagram.raiseDiagramEvent('ChangedSelection');

How to select all components inside a group?

You have to decide whether to select nested group members or not. (Or maybe your app doesn’t have nested groups.)

Call Diagram.selectCollection on either Group.memberParts or on the result of calling Group.findSubGraphParts.

We have nested group members .

Can you give me an example to select all component inside a group.

If you first want to make nothing selected, call Diagram.clearSelection. Then do what I said above:

var group = ...
group.diagram.selectCollection(group.findSubGraphParts());