How to use the @microsoft/sp-page-context.SPPermission.editListItems function in @microsoft/sp-page-context

To help you get started, we’ve selected a few @microsoft/sp-page-context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-fx-extensions / samples / react-field-toggle / src / extensions / toggle / ToggleFieldCustomizer.ts View on Github external
public onRenderCell(event: IFieldCustomizerCellEventParameters): void {
    // Use this method to perform your custom cell rendering.  The CellFormatter is a utility
    // that you can use to convert the cellValue to a text string.
    const value: string = event.cellValue;
    const id: string = event.row.getValueByName('ID').toString();
    const hasPermissions: boolean = this.context.pageContext.list.permissions.hasPermission(SPPermission.editListItems);

    const toggle: React.ReactElement<{}> =
      React.createElement(Toggle, { checked: value, id: id, disabled: !hasPermissions, onChanged: this.onToggleValueChanged.bind(this) } as IToggleProps);

    ReactDOM.render(toggle, event.cellDiv);

  }
github SharePoint / sp-dev-fx-extensions / samples / react-field-slider / src / extensions / slider / SliderFieldCustomizer.ts View on Github external
public onRenderCell(event: IFieldCustomizerCellEventParameters): void {
    // Use this method to perform your custom cell rendering.  The CellFormatter is a utility
    // that you can use to convert the cellValue to a text string.
    const value: string = event.cellValue;
    const id: string = event.listItem.getValueByName('ID').toString();
    const hasPermissions: boolean = this.context.pageContext.list.permissions.hasPermission(SPPermission.editListItems);


    const slider: React.ReactElement<{}> =
      React.createElement(Slider, { value: value, id: id, disabled: !hasPermissions, onChange: this.onSliderValueChanged.bind(this) } as ISliderProps);

    ReactDOM.render(slider, event.cellDiv);
  }

@microsoft/sp-page-context

Page context services for the SharePoint Framework

https://aka.ms/spfx/license
Latest version published 3 months ago

Package Health Score

66 / 100
Full package analysis

Similar packages