primereact
primereact copied to clipboard
Support of bodyTemplateWrapper for DataTable
[X ] feature request
Current behavior column based editing feature is limited as its not supported to wrap it in a form. All UI components are bound to some Form context library and require a form. To do that and make use of Form context, we need to wrap complete datatable in a Form and FormContext, so we can make use of it for column editing. We need to have inlineediting at the same time to show Form based details when row is expanded. To nest form ( for column editing) inside another form( Expandable Details) is not possible As well we want to control visualization of submit a row inline editing by ourselves.
Expected behavior provide a rowTemplate function to DataTable, which allows us to pass <Form> around it. This is similar requiment as of https://github.com/primefaces/primereact/issues/1528
This is how it could look like (psyeudo code):
const onSubmit = () => {};
<DataTable
rowTemplate= (defaultChildren) => <Form onSubmit=onSubmit >defaultChildren</Form>
columns=[column={(isEditing) => <InputText/>} actionColumn={<SubmitButton handleClick={onSubmit}}]
Hi @raDiesle,
Thanks a lot for your feedback! Doesn't the editor property solve this problem for editable cells?
Thanks again ;)
Hi @mertsincan ,
thanks for reply. The Editor does not fix the problem.
the common case in short:
- in every React.js application you will use a form binding framework with its context. All input components are bound to its logic and will not work without
The problem I described above in detail: in b2b applications with CRUD Forms you want to reuse components and their special behaviour. Lets say, you have a form to "create a new item". In the table you show the list of items in a datatable with editable functionality to update.
Both forms use the same or similiar inputs, such as a dropdown with value options prefilled from server.
At the same time, you use a Form component tag with a Form Context ( e.g. Formik) binding framework which is connected in your inputs.
Right now, there is no way to use <Form> and <FormContext> for a row, - that is why we cannot reuse the inputs from "Create Form" in the data-table with "editor".
Any update?
This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you for your understanding!