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?
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?
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);
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 });
}