reactjs - How to set checked on item in DetailsList control -
i use detailslist component office-ui-fabric-react library:
import {detailslist} 'office-ui-fabric-react/lib/detailslist'; render () { const item = [ {value: 'one'}, {value: 'two'} ] return ( <detailslist checkboxvisibility={checkboxvisibility.always} items={items} selection={selection} /> }
how set checked item value `two?
noticed passed selection
detailslist. there's few methods in selection
that, including:
setallselected(isallselected: boolean)
setkeyselected(key: string, isselected: boolean, shouldanchor: boolean)
setindexselected(index: number, isselected: boolean, shouldanchor: boolean)
in case, can give each value key
. , call setkeyselected
somewhere (for example, componentdidmount) tell detailslist select specific items.
Comments
Post a Comment