1

Is it possible to get all (not only selected) rows\items in ListView when ListView Command Set onExecute() method is called?

E.g.:

  @override
  public onExecute(event: IListViewCommandSetExecuteEventParameters): void {

    switch (event.itemId) {
      case 'COMMAND_1':
        let rows = this.context.listView.getAllRows() // <! something like that?
        break;
      case 'COMMAND_2':
        Dialog.alert('COMMAND Two');
        break;
      default:
        throw new Error('Unknown command');
    }
  }

1 Answer 1

1

Workaround:

Get list view id, then get items based on id.

case 'COMMAND_1':
        console.log(this.context.pageContext.legacyPageContext);
        var viewId=this.context.pageContext.legacyPageContext.viewId;
        Dialog.alert(viewId);
        break;

pnp.sp.web.lists.getByTitle("").views.getById()

How get sharepoint list items by view(s) in spfx?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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