Comments (6)
What part is not working above? When you say same behavior, can you be more specific there are several things in the thread you linked. Thanks!
from pnpjs.
It is a custom web part - for the sake of simplicity I've created an OOB HelloWorld web part.
The web part is successfully found from the web part definitions and built with the code
helloWorldPoCPart = ClientSideWebpart.fromComponentDef(helloWorldPoCDef[0]);
However, when I add it to the page, it is rendered as a blank web part:
https://user-images.githubusercontent.com/23637375/36662564-aa582f8e-1ad6-11e8-8193-20ed1bead0c2.PNG
According to the discussions in the linked bug, I have modified the Component's ID without brackets. Note that I've tried both with the original definition (with brackets) and without brackets.
UPDATE 1: I've modified the ClientSidePageComponent object's Id property with toLowerCase() and it now appears. For now, I've implemented a method which fixes the Id of the web part
from pnpjs.
So the guid from your custom component definition contains capital letters, meaning the id is as well. When you make them lower-case it then works? Can you share the code that "fixes" the issue? I'd like to get this resolved in the library if possible.
from pnpjs.
Sure, it is quick and dirty code, but here it is:
`
// code within another method
someMethod(): void {
const partDefs: ClientSidePageComponent[] = await sp.web.getClientSideWebParts();
const helloWorldPoCDef: ClientSidePageComponent[] = partDefs.filter(c => c.Name === "HelloWorld");
let fixWebPart: ClientSidePageComponent = this.fixClientSideWebPart(helloWorldPoCDef[0]);
let helloWorldPoC: ClientSideWebpart = ClientSideWebpart.fromComponentDef(fixWebPart);
}
private fixClientSideWebPart(webpart: ClientSidePageComponent): ClientSidePageComponent {
let fixedWebPartDefinition: ClientSidePageComponent = webpart;
fixedWebPartDefinition.Id = webpart.Id.replace("{", "").replace("}", "").toLowerCase();
console.log("ID set: " + fixedWebPartDefinition.Id);
return fixedWebPartDefinition;
}
`
I was thinking to match the id of the ClientSidePageComponent object with the ClientSidePageComponent -> manifest object (needs JSON.parse though)
from pnpjs.
I can inside of the fromComponentDef method make these adjustments when I set the id. So perhaps that will be enough. Thanks for sharing the code.
from pnpjs.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
from pnpjs.
Related Issues (20)
- How to get Large list data using getAll() with single API call? HOT 3
- Caching does not work at all in 3.22, but works just fine in 3.21 HOT 2
- *Paged* caching does not work correctly with latest 3.23 release, but works just fine in 3.21 HOT 4
- Wrong contextinfo url when using fileFromAbsolutePath and fileFromPath HOT 3
- utility.searchPrincipals() returns -1 for PrincipalId HOT 4
- graph: Cancel Event HOT 5
- Get pages within list with specific term id HOT 2
- How to update SharePoint Online column type using pnp/sp? HOT 5
- How to keep deleted sites in to recycle bin instead of delete permanently? HOT 5
- Documentation is incorrect HOT 5
- CalendarView getDelta HOT 6
- Change file content without creating a new version HOT 4
- Access denied when adding a file. HOT 4
- Select ,expand and filter limits HOT 4
- Not a valid JSON HOT 14
- Property 'delete' does not exist on type 'DirectoryObject' HOT 2
- How do I get the Id of age page I just created with addClientsidePage? HOT 3
- Use regular `enum` instead of `const enum` (`verbatimModuleSyntax`) HOT 4
- graph: Cancel Event Error Handling HOT 3
- Save document as draft/minor version HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pnpjs.