Rune
Rune

Reputation: 381

SP.ListOperation.Selection.getSelectedItems() and Sharepoint Framework

Does SharePoint framework have its own way of getting selected items from a list or do we still need to use SP.ListOperation.Selection.getSelectedItems()?

If latter, how do I make it available in a Typescript/spfx solution?

Upvotes: 2

Views: 667

Answers (2)

Mikhail Zhuikov
Mikhail Zhuikov

Reputation: 1257

CSOM SharePoint has nothing to do with third-party frameworks, it works great on its own, see a large number of examples and articles on the Internet.

var context = SP.ClientContext.get_current();
var selectedItemIds = SP.ListOperation.Selection.getSelectedItems(context);

Upvotes: 0

AbdulAzizFarooqi
AbdulAzizFarooqi

Reputation: 111

it is bit different. To learn about Create Dropdown in Ract.

We have to set state in react. On selected Item change it will call the methods which will set the ItemCountry in the class.

Add this to your Render Method.

<select value={this.state.ItemCountry} className={styles.myinput} onChange=
{this.onChangeSelect.bind(this)}>{options}
                        </select>

Add this to your constructor

this.state = {           
        ItemCountry: "Select Country",          
    };

Add this method in your class.

public onChangeSelect(event: any): void {
    this.setState({ ItemCountry: event.target.value });
}

Upvotes: -1

Related Questions