4

I am able to get the currently selected folder in CME using: $models.getNavigator().properties.contextUri;

Below is the output:

enter image description here

However, I am unable to get the currently selected item in right pane. As seen in above screenshot, the item : "BrandCalippo" is selected.

I have checked the properties object of $models.getNavigator().properties but cannot find any relevant key to get the selected item.

Is it possible to get the URI of currently selected item similar to the way ContextUri is read as above?

6

This isn't how you are supposed to get the selected items.

The recommended approach is to create a command for your feature, which will then get called with the selection of items -- either from the tree, the list, the item editing screen, or some other context.

The idea is that your command should work regardless of the UI controls that might use it. It should be decoupled from the inner workings of those controls.

So, for instance, if you add an option to the context menu you then also specify the command that the option uses. The IsEnabled and IsAvailable methods will then get called automatically when the selection changes (regardless of context) and should return true if the command is available / enabled based on that selection of items.

The context menu option will then hide itself (if IsAvailable returns false) or disable itself (if IsEnabled returns false) -- or the opposite, depending on your code. When the user clicks on the context menu option, the Execute method will be called on your command. You can then do whatever it is you wish to do on that selection of items.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.