[Question] Retrieve more info in the onSelectDate
Hi All,
I have a DatePicker control that is inside a dynamic table where users can freely add/remove a row.
I want to keep track of the value of the DatePicker control on each row but I couldn't find any ways to put extra attribute on the DatePicker like inputProps: { "data-row-id" : row.ID }.
Also when the event onSelectDate is hit, it only contains the date value and nothing more, no event or anything. Do we have some work around for this ?
Thanks,
@lorejoh12 Can you take a look at this one and advise?
What scenario are you trying to use this for? I'm not sure what event you're trying to get, the click event from the popup? Not clear to me how useful that would be.
Maybe you're trying to just see which DatePicker's value was changed? For that, my suggestion would be something like this:
<DatePicker
onSelectDate={this.onSelectDate(rowId)}
...
function onSelectDate = (rowId: string) => (date: Date) => {
// now you have access to which row you're in, and which date was selected
}
sort of like this: https://codesandbox.io/s/61wmnomnnn
And then you could keep a separate map of values of rowId to selected value perhaps? Hope this is useful.
Thanks @lorejoh12 . I didn't know you could do that in Typescript. That is mind blowing. Could you tell me what this line of code mean ?
function onSelectDate = (rowId: string) => (date: Date) => {
}
Other than that, you suggestion worked !
This issue has been automatically marked as stale because it has not activity for 60 days. It will be closed if no further activity occurs within 14 days of this comment. Thank you for your contributions to Fabric React! Why am I receiving this notification?
This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Fabric React! Why am I receiving this notification?