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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -