sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Mismatch in SPFX ListviewCommandSet buttons visibility in modern Document Library

Open devoooo4u opened this issue 8 years ago • 5 comments

Category

  • [x] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

When set the visibility of the the custom button, It should be applicable at both places (ContextMenu + CommandBar). I am having 2 buttons (Add Fav + Remove Fav). Based on few conditions, i am setting them up as visible = true / false. So this visibility setting should be applied globally for both (ContextMenu + CommandBar) but shows otherwise behavior. Note: this behavior is noticed if I do multiple Add/remove Favorite operation on single document.

Observed Behavior

Buttons are mismatched.. If "Add To Fav" is set to be visible "true" is should be at both the places (Context menu + Command Bar).. & vice versa for "Remove from Fav" button.

refer SS,
image

Steps to Reproduce

Consecutive attempts to add and remove favorite button for an item leads to this button mismatch . This is my element.xml file structure::

 <CustomAction
        Title="FavouriteButton"
        RegistrationId="101"
        RegistrationType="List"
        Location="ClientSideExtension.ListViewCommandSet"
        ClientSideComponentId="guid">
    </CustomAction>

and commandsetmanifest.json file::

  "items": {
    "AddFavourite": {
      "title": { "default": "Add to Favourites" },
      "iconImageUrl": "/Fav.png",
      "type": "command"
    },
    "RemoveFavourite": {
      "title": { "default": "Remove from Favourites" },
      "iconImageUrl": "/RemoveFav.png",
      "type": "command"
    }
  }

Submission Guidelines

# EDIT 1: We can set the the location of custom command buttons by Location="ClientSideExtension.ListViewCommandSet". Is there a way possible where I can capture the Events triggered by ContextMenu & CommandBar buttons separately. ??

Thanks for your contribution! Sharing is caring.

devoooo4u avatar Mar 13 '18 08:03 devoooo4u

Thanks for your feedback. How do you track these conditions that cause one command or the other to be visible? When you have a command set in both context menu and command bar those are 2 different instances of the command set. If you are relying on any variable from the object at runtime, that may cause this unexpected behavior.

mpasarin avatar Mar 13 '18 23:03 mpasarin

Thank you mpasarin fo the response, And yes I am relying on Object value calculated during runtime since I am managing the buttons visibility based on items retrieved from a List. Also, I observed that overridden method @onListViewUpdated is triggered multiple times (6+ times) during single toggle of List Item selection, This can be optimized too. so two buttons (Context menu and Command Ribbon) are slightly deviated from being duplicate buttons. Thanks! Sharing is Caring !

devoooo4u avatar Mar 14 '18 05:03 devoooo4u

Any news on this issue? Visibility on command set buttons should be possible to update.. Did you find any workaround @devoooo4u ?

frnk01 avatar Dec 03 '18 13:12 frnk01

Hi, sorry for the long delay. We are trying to clean up and make sure we haven't missed issues. We are unable to repro this issue now. Please feel free to create a new issue / reopen this one if the particular case is still a problem.

patmill avatar Sep 07 '21 20:09 patmill

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar Sep 15 '21 00:09 ghost