Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPFx Commandset title not changing #1177

Closed
2 tasks
maliksahil opened this issue Dec 23, 2017 · 11 comments
Closed
2 tasks

SPFx Commandset title not changing #1177

maliksahil opened this issue Dec 23, 2017 · 11 comments
Labels
area:spfx Category: SharePoint Framework (not extensions related) status:fixed Issue was fixed in current or prior release. status:tracked Currently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed) type:bug-confirmed Confirmed bug, not working as designed / expected.

Comments

@maliksahil
Copy link
Contributor

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

  • Question
  • [x ] Bug
  • Enhancement

Expected or Desired Behavior

I'm using node 6.12, npm 3.10, and SPFx 1.4 on a Modern site.
I generate a commandset extension (new project), deploy - everything works as expected.
Now, I want to change the logic .. I want to show change the title of "COMMAND_1" to reflect the number of rows selected.

I change my onListViewUpdated as follows,

public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
if (compareOneCommand) {
// This command should be hidden unless exactly one row is selected.
compareOneCommand.visible = event.selectedRows.length > 0;
console.log(event.selectedRows.length);
compareOneCommand.title = "Selected " + event.selectedRows.length;
}
}

Now I go about selecting rows - but even though in debug mode event.selectedRows.length shows me the correct value, and compareOneCommand.title shows the proper value, the in UX, the title always says "Selected 0".

Expected: Selected x .. where x is number of rows selected.

Observed Behavior

The title always says "Selected 0" which is incorrect.

Steps to Reproduce

As above ..

Thanks for your contribution! Sharing is scaring.

@VesaJuvonen VesaJuvonen added status:tracked Currently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed) type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. labels Dec 28, 2017
@andrewconnell andrewconnell added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:bug-confirmed Confirmed bug, not working as designed / expected. and removed status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. labels Jun 19, 2019
@paulwillen
Copy link
Contributor

Just a notice that this is still an issue - Is there a ETA for a fix for this?

@digbar
Copy link

digbar commented Jul 7, 2020

Hey guys.

Trying to make this work.
I am using v1.4.1 for SP19.
I guess if it where it was probably for the latest versions.
Is that correct @andrewconnell?

@tripleseven73
Copy link

Ran into this issue today. It seems as if the HTML for a Command is generated once and then shown/hidden depending on the .visible property?

In #6245 @andrewconnell states that "Dynamically switching the title is not supported". However the documentation of the Command class title property suggests it should be possible and as an example even describes a scenario that is, for all intents and purposes, the same as the one described by @maliksahil.

Any ETA for a solution?

@andrewconnell
Copy link
Collaborator

It's my understanding that you can't change the title of a command set button/link. The reason why is because it's defined in the manifest for the component where you can also localize the title.

Microsoft needs to confirm that, but that's my undersatnding.

@Katli95
Copy link

Katli95 commented Mar 18, 2021

If so, then the docs are out of date or at least incorrect, in the ones mentioned by @tripleseven73 they say:

Altering the title property is intended to allow minor changes to the title, e.g. “Submit these 3 items” or toggling between “Schedule” and “Unschedule”...

I also feel like this used to work, and was included in some demos from Microsoft, but I don't have the links to back it up.

@andrewconnell andrewconnell added area:spfx-extensions Category: SharePoint Framework Extensions status:to-be-reviewed Issue needs to be reviewed by Microsoft for additional follow up / review. labels Mar 18, 2021
@andrewconnell
Copy link
Collaborator

I double-checked with the SPFx engineering team and the docs are correct; the title property should respect changes from the API. They're investigating and if there's an update to provide, they'll chime in.

@Katli95
Copy link

Katli95 commented May 4, 2021

Has there been any update on this? It seems insignificant but having the ability to change "selected document" to "selected documents" is actually quite valuable to UX 😇 (Even more so for languages with greater changes in singular v. plural)

@hamedy
Copy link

hamedy commented Jun 3, 2021

sent a proposal to a customer that requires this feature and I'm stuck now. I'm implementing adding/removing documents to personal favourites and I need the ability to change the command title. Appreciate it if you provide a ETA for a fix.

@mayo589
Copy link

mayo589 commented Jun 18, 2021

Hi, we are waiting for this fix too, the ability to dynamically set title of our commands is crucial for us :)

@VesaJuvonen VesaJuvonen added area:spfx Category: SharePoint Framework (not extensions related) and removed area:spfx-extensions Category: SharePoint Framework Extensions labels Nov 1, 2021
@patmill
Copy link
Contributor

patmill commented Nov 3, 2021

The title can be changed on execute (as of a month ago), but not on listview updated. The latter is tracked by #7375

@patmill patmill closed this as completed Nov 3, 2021
@patmill patmill added status:fixed Issue was fixed in current or prior release. and removed status:to-be-reviewed Issue needs to be reviewed by Microsoft for additional follow up / review. labels Nov 3, 2021
@ghost
Copy link

ghost commented Nov 11, 2021

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 ghost locked as resolved and limited conversation to collaborators Nov 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:spfx Category: SharePoint Framework (not extensions related) status:fixed Issue was fixed in current or prior release. status:tracked Currently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed) type:bug-confirmed Confirmed bug, not working as designed / expected.
Projects
None yet
Development

No branches or pull requests

10 participants