4

I've created a new extension to SPFx to create a new item for a list. This contains more checks then the default action, because some fields depends on an other field. My question is now how could I replace the default "new" command by my custom created "new" command?

Same thing with the "edit" command.

2
  • 2
    You need hide original with CSS and move your to its position. Commented Jan 30, 2019 at 15:19
  • @ZdeněkVinduška: Removing the buttons using CSS is not a good opinion because other buttons from other lists will being removed to. 🙁 Commented Jan 31, 2019 at 8:47

2 Answers 2

3

Unfortunately removing default buttons in not supported in modern SharePoint right now. One alternative is to customize the form in power-apps and remove all the fields from the form. Leaving the form with a label "This form isn't functional".

Now the user is supposed to click the other command button. This is what we did as a work around.

2
3

You can always, although it is not recommend, hide buttons with css, with the help of a spfx application customizer.

Lets say you want to hide the "new button", just need to make yout spfx extension import a custom css or sass file with:

  button[data-automationid="newCommand"] {
    display: none;
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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