누구나 세부 정보 목록에 단추를 집중시키는 방법에 대한 제안이 있습니까? 참고 문헌 길을 가야하는 것처럼 보일, 나는 같은 것을 할 싶습니다React와 Office Fabric을 사용하여 세부 정보 목록에 단추를 초점 맞추는 방법
findDOMNode<HTMLButtonElement>(this.refs.mybutton).focus()
하지만 버튼 요소에 심판 핸들을 얻을 수 없었다. 지금 얻을 수 있습니다) didComponentMount (에서
<PrimaryButton
onClick={() => this.handleActionSelection(fieldContent)}
ariaDescription={buttonText}
text={buttonText}
ref={"ButtonIWantToFocus"}
/>
:
<DetailsList
onRenderItemColumn={this.renderItemColumn}
ref={(list) => {this.detailsList = list;}}
....
/>
내가 집중하려는 버튼 (renderItemColumn에서 오는) : 나는 시도했다
한 가지 방법은 내 DetailsList에 DetailList에 액세스 할 수 있지만 포커스를 단추 참조를 얻는 방법을 잘 모르겠습니다.
또는 I는 다음과 같이 버튼을 정의 할 수 있습니다 :이 버튼에 나에게 핸들을 제공
<PrimaryButton
disabled={true}
ariaDescription={buttonText}
text={buttonText}
ref={(button) => {this.focusButton = button;}}
/>
을하지만, 포커스() 함수가 없습니다.
의견을 보내 주셔서 감사합니다.
감사합니다. 문제는 OfficeFabric과 관련이 있다고 생각합니다. PrimaryButton 요소에는 focus() 함수가 없습니다. 내가 테이블에 없을 때 그것을 집중시킬 수 있었던 유일한 방법은 : findDOMNode (this.refs.doneExtractingButton) .focus(); –
Lars
죄송합니다. dom 요소가 아니라 구성 요소를 사용하고있는 것으로 나타났습니다. 짧은 읽기 후에'ref' 대신에'prop'' componentRef'를 사용해야합니다. 나는 나의 예를 –
환상으로 업데이트 할 것이다. 매우 감사. – Lars