2016-04-14 9 views

答えて

3

ダイアログopen状態がそれを行うための唯一の方法はDatePickerrefを使用してfocus()を呼び出すことになる、material-uiコンポーネントによって内部的に処理されているので。ハックのようなもの - それは動作します。..

例:

<DatePicker 
    ref='datePickerStartDate' 
    errorStyle={componentSyles.error} 
    textFieldStyle={componentSyles.textField} 
    DateTimeFormat={Intl.DateTimeFormat} 
    cancelLabel={cancelLabel} 
    autoOk={true} 
    {...this.props} 
    /> 

<FontIcon 
    onClick={(e) => { this.refs.datePickerStartDate.focus() }} 
    className="material-icons" style={componentSyles.icon}> 
    date_range 
</FontIcon> 
+0

ねえ、これは素晴らしい作品、ありがとう。 1つの質問:これは動的に作成された項目のリストで、日付ピッカーが付いています。配列インデックスのコンテキストは常に配列の最後の項目に設定されますが、入力として使用すると機能します良い。正しいインデックスをどのように渡すか? –

+0

索引をその関数にバインドしようとしましたか?もしそうなら、いくつかのコードを提供できますか? –

関連する問題