0

I want to create custom web part property in SPFX web part.
I am referring GitHub "sp-dev-fx-webparts-master" and other reference links...
in that reference, webpart.ts file contain "get propertyPaneSettings()" method and in my environment webpart.ts file by default contain "getPropertyPaneConfiguration()" method.

so, is there any difference between those method or both are same ?

reference link code.

protected get propertyPaneSettings(): IPropertyPaneSettings {  
    return {  
      pages: [  
        {  
          header: {  
            description: strings.PropertyPaneDescription  
          },  
          groups: [  
            {  
              groupName: strings.BasicGroupName,  
              groupFields: [  
                PropertyPaneTextField('description', {  
                  label: strings.DescriptionFieldLabel  
                })  
              ]  
            }  
          ]  
        }  
      ]  
    };  
  }  

My Web part Code.

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
    return {
      pages: [
        {
          header: {
            description: strings.PropertyPaneDescription
          },
          groups: [
            {
              groupName: strings.BasicGroupName,
              groupFields: [
                PropertyPaneTextField('description', {
                  label: strings.DescriptionFieldLabel
                })
              ]
            }
          ]
        }
      ]
    };
  }
  • Hi Chandresh - Can you point to links that are showing the old data? I will make sure we clean them up. Thanks. – PatMill_MSFT Jun 23 '17 at 17:22
  • c-sharpcorner.com/article/… – Chandresh Jun 24 '17 at 9:41
  • youtube.com/… – Chandresh Jun 24 '17 at 10:11
  • 1
    Thanks. We don't really have control over the first article, but I'll see about getting the youtube video updated (or at least a pointer to the correct bits). – PatMill_MSFT Jun 26 '17 at 16:47
  • 1
    Have just added a note on the YouTube video. One of the slides shown in this video is using older method for property pane settings (with IPropertyPaneSettings), but demo is up to date. We'll get this updated in the video with next round of updates. We do recommend using official documentation from dev.office.com/sharepoint for the up to date guidance. Here's for example getting started guidance for web parts - dev.office.com/sharepoint/docs/spfx/web-parts/get-started/… – Vesa Juvonen Jun 26 '17 at 17:44
3

Your reference code is referring to an older version of SPFx. IPropertyPaneSettings was used prior to RC0. But now, after RC0 and GA we are using IPropertyPaneConfiguration.

So, your webpart implementation is correct. So, both are the same "functionality" wise, but you should be using IPropertyPaneConfiguration in your code as IPropertyPaneSettings is now deprecated.

SPFx - Release Notes RC0

  • welcome, glad it helped :) , please mark it as answer so it won't show up in the unanswered section, its just the checkmark below the upvote button ! – Gautam Sheth Jun 23 '17 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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