queryOptions

I want to hit an Api with a specific route, for exampe, lets say api/user-directories/ for example to show a root directory. how can I use queryOptions on a table to be able to add those query parameters to the query? I'm totally stuck on this. const {tableProps, sorter} = useTable<any>({ initialSorter: [ { field: "id", order: "desc", }, ], initialPageSize: 25, queryOptions: { queryKey: 'path', } });
Omer
Omer578d ago
Hey @rothwulf 👋 , Thanks for reaching out to us. Could this be what you're looking for? https://refine.dev/docs/faq/#how-can-i-request-an-api-with-nested-route
fascinating-indigo
fascinating-indigo578d ago
Thank you very much @Omer. Let me check please and try in my codebase. I really appreciate it. No @Omer It didn't work. when I add the nested route here, I don't hit the api from the backend.
Omer
Omer578d ago
Sorry, I didn't understand exactly what you want to do
fascinating-indigo
fascinating-indigo578d ago
i need to make a query to a route of a Api with this kind of structure for example: api/v1/profile-directories?path=%2F Because I don't know how to pass the query parameters using queryOptions: const {tableProps, sorter} = useTable<any>({ initialSorter: [ { field: "id", order: "desc", }, ], initialPageSize: 25, queryOptions: }); I have no idea about what I should pass in queryOptions for passing that path=%2F query parameter. Sorry if I don't have too much knowledge about react-query, but this is related to React Query.
Omer
Omer578d ago
Aha okay. You can use "metaData" for this. Could you check out this doc? https://refine.dev/docs/faq/#how-i-can-override-specific-function-of-data-providers
FAQ | refine
How can I change the form data before submitting it to the API?
fascinating-indigo
fascinating-indigo578d ago
Sure, thank you very much. I really appreciate your help @Omer
Omer
Omer578d ago
If it doesn't work, just let us know. We will be happy to assist you ⚡️
fascinating-indigo
fascinating-indigo578d ago
Thank you very much. Sorry @Omer I don't really understand how to use it. I didn't sleep all night trying to solve this issue. Something like this:? const {tableProps, sorter} = useTable<any>({ initialSorter: [ { field: "id", order: "desc", }, ], initialPageSize: 25, resource: "<path with query parameters here?", metaData: { httpMethod: "patch", } }); But this requires to modify the App.js and I was asking to only touch the file with the table. and to use queryOptions according to my team.
Omer
Omer578d ago
General Concepts | refine
- refine core is fully independent of UI. So you can use core components and hooks without any UI dependency.
fascinating-indigo
fascinating-indigo578d ago
Sure, but there is not a way to use the queryOptions?
Omer
Omer578d ago
You can't with queryOptions. You can pass data to your dataProvider using metaData 🚀
fascinating-indigo
fascinating-indigo578d ago
Thank you very much @Omer, then, I'll better discuss with my team about this.
fascinating-indigo
fascinating-indigo577d ago
Thank you very much @Omer Hi @Omer can I ask you one more question please?
Omer
Omer577d ago
Yes
fascinating-indigo
fascinating-indigo577d ago
Thank you very much.
fascinating-indigo
fascinating-indigo577d ago
In the case that for example, the fields of a table like the table you showed me, were not just records, but for example folders. How can I implement a functionality that shows me the contect of each folder with a click. I'm sorry for asking too much. Just I started with Refine two days ago and it's being a little bit hard to understand the whole entire system. At the moment I'm trying, using useShow and useCustom but I'm not pretty sure.
No description
Omer
Omer577d ago
Don't worries 🍻 Is this what you are looking for? https://refine.dev/docs/examples/table/react-table/advanced-react-table/
fascinating-indigo
fascinating-indigo577d ago
let me check please and thanks a lot! No @Omer, not really. Similar but when I click a button I need to see the content of each listed item (considering that the item is a directory).
Omer
Omer577d ago
Sorry, I don't understand exactly what you want to do. Have you finished the refine tutorials? https://refine.dev/docs/
Tutorials | refine
Introduction
More Posts
Add smooth scroll effect in iconsHey everyone I want to made some changes in footer section of the this website but I'm not able to fHide *Button for forbidden actionsHi! Is there a way to avoid the disabled button for actions an user cannot do (because unauthorized)difference between importing from refinecore and refineantdfor example i have a component useSelect so if i import it from refinecore it dont have same props cI am getting 301 status using refine-simple-rest although there is not any error on postman.I am using refine-simple-rest as my data provider to connect with the django rest API but I get backchange label of breadcrumbi am using breadcrumb in create page but i am getting its as patients/create i want to change labeluseSelect onSearch without call API cos i got limit call APIcan i call API once and search query without recall API?How to submit a modal form to create a Comment when you are in the Post show page?Given the fact that I'm a first timer using React, Building refine app has been amazing. What I'd liMaking duplicate calls in the apiUsing the github example (finefoods - mui), the application is making duplicate calls in the api Docustom route element not visible{ element:<div> <LayoutWrapper>sssshhhhh</LayoutWrapper> </divpagination not working if i use filtered value and onfilter props in ant table columnfilteredValue={[consultationState]} onFilter={(value:any,record:any)=>{ return recorduseform-metadataBut the error is coming from the UserWithRolesRemove useModal form titleI want to remove title from useModalForm so i gave title ={null } its not workinguseExport with arrays in schemaI have resources that have array fields, which I am spreading to fields like `arrayItem.0.name, arrastartswith operatorstartswith operator not supportedediting usemodal form footeri am having a custom button in antmodal footer footer={<Button >okk</Button>} if i click on this sasetFilters for json objectis there a way to apply nested filters for json b object retuning from usetable , using setFiltersfiltering ant table based on useSelect hookconsider i have select dropdown where i have values as one, two and three . Below i have ant table wselectionSet issueError: unexpected null value for type "uuid": {"response":{"errors":[{"extensions":{"path":"$.selectselection sort issuefield "krseva_frequencies" not found in type: 'query_root': {"response":{"errors":[{"extensions":{"pmigration issues./node_modules/@pankod/refine-react-router/dist/esm/index.js 49:10-11 export 'useIsAuthenticated' (i