Derek
Derek
Explore posts from servers
RRefine
Created by deep-jade on 9/21/2023 in #ask-any-question
How can I just see the current fields value?
So this seems like a really dumb question, but using refine, its really difficult to use the value of a field. What I mean by that is I want to check if a checkbox is checked, if its checked, I want to show additional fields. Problem is, I cant find the actual value that updates as I'm toggling the checked box:
<Form.Item
label="Is Limited Edition"
valuePropName="checked"
name={["is_limited_edition"]}
>
<Checkbox>Is Limited Edition</Checkbox>
</Form.Item>
<Form.Item
label="Is Limited Edition"
valuePropName="checked"
name={["is_limited_edition"]}
>
<Checkbox>Is Limited Edition</Checkbox>
</Form.Item>
How can I get the value of is_limited_edition?
5 replies
RRefine
Created by sensitive-blue on 8/25/2023 in #ask-any-question
How to transform a value before it gets sent for a resource update
Hi all! As the title states, I would like to know what the best practice is for transforming a value before it gets sent to the server to update a resource. Code:
export const ArtistEdit: React.FC<IResourceComponentsProps> = () => {
const { formProps, saveButtonProps, queryResult } = useForm();
const artistsData = queryResult?.data?.data;

return (
<Edit saveButtonProps={saveButtonProps}>
<Form.Item
label="Date Of Birth"
name={["date_of_birth"]}
rules={[
{
required: true,
},
]}
getValueProps={(value) => ({
value: value ? dayjs(value) : undefined,
})}
>
<DatePicker />
</Form.Item>
</Edit>

)

}
export const ArtistEdit: React.FC<IResourceComponentsProps> = () => {
const { formProps, saveButtonProps, queryResult } = useForm();
const artistsData = queryResult?.data?.data;

return (
<Edit saveButtonProps={saveButtonProps}>
<Form.Item
label="Date Of Birth"
name={["date_of_birth"]}
rules={[
{
required: true,
},
]}
getValueProps={(value) => ({
value: value ? dayjs(value) : undefined,
})}
>
<DatePicker />
</Form.Item>
</Edit>

)

}
In this code sample, I need to make sure the value of date_of_birth conforms to the backends requirement for date parsing. What is best practice here to do when working solely with refine?
5 replies
RRefine
Created by ambitious-aqua on 8/18/2023 in #ask-any-question
How do I use `useEditableTable` with my own custom data fetcher/update logic?
Essentially, I want to use the useEditableTable hook without a resource. I have backend call that can fetch all my models; and I have another one that can update a model
19 replies
RRefine
Created by adverse-sapphire on 7/6/2023 in #ask-any-question
whats best practice for customizing document title on a specific resource route?
Essentially, I have a show route that I want the document title to be "{name of user} Artist Review | MyService" instead of what it currently is, which is "#1 Show Review Artist | MyService" what is the best practice for this?
5 replies