Edit

BaseListViewCommandSet class

This is the base class that third parties should extend when implementing a client-side extension that provides a command set for a SharePoint list view.

Extends

BaseExtension<TProperties>

Remarks

In the component manifest, the "extensionType" should be set to "ListViewCommandSet".

Properties

context

Use the context object to access common services and state associated with the component.

Methods

onExecute(event)

This event occurs when the command is invoked, e.g. because the user clicked on the toolbar button or menu item. virtual

onListViewUpdated(event)

This event occurs whenever the ListView state changes. virtual

raiseOnChange()

Use this method to fire OnChange event and initialize a reflow of the ListView.

tryGetCommand(id)

Returns the command with the given id. Returns undefined if there is not command with the given id.

Property Details

context

Use the context object to access common services and state associated with the component.

readonly context: ListViewCommandSetContext;

Property Value

Remarks

Child classes are expected to override this field by redeclaring it with a specialized type. It is meant to be a read-only property; the type cannot be declared as read-only in the base class (because it is initialized outside the constructor), but child classes should redeclare it as readonly.

Method Details

onExecute(event)

This event occurs when the command is invoked, e.g. because the user clicked on the toolbar button or menu item. virtual

onExecute(event: IListViewCommandSetExecuteEventParameters): void;

Parameters

Returns

void

onListViewUpdated(event)

Warning

This API is now deprecated.

Use context.listView.listViewStateChangedEvent instead.

This event occurs whenever the ListView state changes. virtual

onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void;

Parameters

Returns

void

Remarks

This event allows the implementor to tailor the visibility of the command.

raiseOnChange()

Use this method to fire OnChange event and initialize a reflow of the ListView.

raiseOnChange(): void;

Returns

void

tryGetCommand(id)

Returns the command with the given id. Returns undefined if there is not command with the given id.

tryGetCommand(id: string): Command;

Parameters

id

string

Id of the command

Returns