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

Implementing the PlaceHolder Content Control #1

Closed
IsYet1 opened this issue Oct 5, 2017 · 3 comments
Closed

Implementing the PlaceHolder Content Control #1

IsYet1 opened this issue Oct 5, 2017 · 3 comments

Comments

@IsYet1
Copy link

IsYet1 commented Oct 5, 2017

[ ] Enhancement

[ ] Bug

[ X ] Question

Version

spfx-controls-react@1.0.0-beta.6

Question - Easier way to implement the Place Holder control?

I'm new to React and to SPFx. :-)
The relevant files are attached in a .zip

Primary questions

  • Best place to put the <Placeholder markup code
  • Best way to get the context to get at the propertyPane

I was able to get the PlaceHolder content control to work but I'm wondering if there's a better way.

My project is called React00 so this is the prefix for all the files.

I put the <Placeholder markup in the React00.tsx file (attached) that has the default React Welcome code.

I got the context from the React00WebPart.ts.
To do that, I used code from a previous project that uses the pnp object in the sp-pnp-js package. After installing the package.
To get it from the WebPart to the React file, I added a WebPartContext property to the IReact00Props.ts interface.

This all works as expected but I'm curious if there's a simpler route.

Thanks!

PlaceHolderSPFxCode.zip

@estruyf
Copy link
Member

estruyf commented Oct 6, 2017

Did not have the time yet to check it, but have you already tested the sample web part? You can find it here: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/pnp-controls

@IsYet1
Copy link
Author

IsYet1 commented Oct 6, 2017

Thanks! I'll definitely take a look at these samples.
I should have mentioned, for clarity, that web part I'm working with was created with the SharePoint generator - React framework.

@IsYet1
Copy link
Author

IsYet1 commented Oct 9, 2017

My code was close. I over-complicated getting the context.
Thanks.

@IsYet1 IsYet1 closed this as completed Oct 9, 2017
estruyf pushed a commit that referenced this issue Apr 17, 2018
Create ListView.ContextualMenu.md
estruyf pushed a commit that referenced this issue Feb 19, 2019
AJIXuMuK pushed a commit that referenced this issue Dec 6, 2019
Fixed Align Left button not working.
AJIXuMuK pushed a commit that referenced this issue Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants