Skip to main content

Thoughts, shortcomings, gotchas on SPFx Dynamic Data capabilities

It's the festive break, and I thought I'd try the new Dynamic Data capabilities that recently went to General Availability in SharePoint Framework 1.7.

I've been building a lot of React components lately, and all the SPFx web parts and application customisers with visual elements we create at Engage Squared, are built on React.  Dynamic Data in SPFx introduces a whole new world of modularity that we haven't had before. We can now split up the page elements into multiple web parts that, in the past, have been combined as one web part so state can be passed between them.  Doing this gives control back to the page author, with the ability to position components how they wish.

Breaking components up in to individual web parts also changes the way the components are designed, and forces the developer to leverage the responsive capabilities of modern pages.  Modern pages are designed from the ground up to work on many different screen sizes, and as long as each individual component respects responsive design, we can let the modern page infrastructure do the rest.

SPFx Dynamic Data: Gotcha and Shortcomings

It's somewhat disappointing to note that Dynamic Data in SPFx is not supported on classic pages.  As of the day I published this post, when you introduce a component that calls the
context.dynamicDataSourceManager.initializeSource()
method on a classic page, you get a
Source id contains invalid characters, like "_".
error - or the full exception details as follows:
@VesaJuvonen's comment on this github issue describes this behaviour as "by design". There doesn't seem to be any thing on the roadmap for classic pages to be supported by SPFx's dynamic data capabilities.

With that shortcoming aside, I found adding dynamic data capabilities to be relatively light-weight, and also flexible enough to use in any number of scenarios (more on that later).

One gotcha I discovered that had me tearing my hair out for a good day or two (in between festive partying, dinner, drinking, and pudding) was when I encountered the following
Serialization failed for web part WebPart.DynamicDataConsumerWebPart.3c797b3b-6634-404c-8772-d09a49f94236
exception:

Don't panic.

This happens when dynamic data properties are added to a web part's propertiesMetadata() readonly call, and have not been added to the properties node of the web part's *.manifest.json file. When your *WebPart.ts file has propertiesMetadata() like this:
... the web part's manifest file should include "dyanmicProperty0" in the "properties" node: After adding them to your web part's .manifest.json file, you will need to redeploy the app's sppkg file to the app catalog, and you will also need to remove and re-add the web part to the page you're working on.

This is a departure from the implementation of other web part properties types. SPFx web part properties have not been required in the .manifest.json file in the past.  I was wondering if the product team will consider this inconsistency to be a bug, so I raised this issue in the sp-dev-docs repo, found here.

Comments

  1. Delhi escorts introduces the most lovable and erotic independent Delhi escorts services to provide you memorable intimacy with call girls in Delhi.
    Call Girl In Delhi

    ReplyDelete

Post a Comment

Popular posts from this blog

Apps for SharePoint 2013 - Client and Server-side code

It's about time I blew the dust off this blog. Tonight I did a presentation at the Melbourne SharePoint User Group entitled Apps For SharePoint (2013). It included two demos based on the App For SharePoint 2013 solution template in Visual Studio 2012.

The two demos illustrated how you can create a separate ASP.Net Web Application. Demo 1 showed how easy it is to hook in to SharePoint to obtain List properties via server-side code (populating an ASP.Net Repeater Control). Demo 2 showed what you can do with SharePoint 2013's Javascript hooks. Specifically, using SP.UI.Controls.js from the /_layouts/15/ SharePoint folder to pull chrome elements out of SharePoint, and render them in your ASP.Net web app.

No animals were harmed in the making of these demos, but a few articles kindly provided on the Microsoft MSDN site helped put it together:
How to: Set up an on-premises development environment for apps for SharePointHow to: Create high-trust apps for SharePoint 2013 using the se…

SharePoint "Like" button

Ever wondered what the users of your Intranet really like or don't like? Ever wanted your SharePoint 2007 site to be more "web 2.0"-ey? Well I've published this quick and dirty codeplex project that allows the addition of a "Like" button the any SharePoint List item page.
The project is available as a WSP, and source code.
It consists of two things - a Web Part that is the button that users click to "Like" or "Unlike" something, and a List Template that can be used to create a list to store who "Likes" an item.
The button has two ways of operating. If it finds a list that was built on the List Template included in the WSP, it allows each user to Like or Unlike an item as they see fit. The button uses the List it found to keep track of who likes a given item, and queries the list when it renders to determine which option should be presented. Along with the button, the web part also displays a brief message explaining how many pe…