-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit resources with NULL values #304
Comments
can you paste a schema and please write which adapter you use (mongoose/typeorm/sequelize)? |
This model for instance, using sequelize adapter. I am able to create a new Partner leaving website as an empty string and its converted to NULL after inserting in the database. But when I try to edit I am not able to do it at all. I tried forcing the allowNull property to true but I get the same error
|
@wojtek-krysiak I've seen the #370 fix go in, but it changes all NULLs to be blank string. I'm planning to have admin-bro working with an existing MSSQL DB via sequelize, and at the moment it will be changing pre-existing records replacing NULLs with ''. I can't afford to allow data changing unexpectedly. Is there a plan to have it handle NULLs or will it continue as its currently implemented? (I can't make any changes via the models I'm using sequelize-auto to generate them on the fly) UPDATE: I'm getting around this at the moment using the following: in record-to-form-data.ts
and then in edit-action.js I'm adding:
|
@mjlawrence83 wow - this is an actual very good solution. We will have to implement this in the core. |
Just sharing the approach I took to resolve this issue.
|
# [3.1.0](v3.0.1...v3.1.0) (2020-08-27) ### Bug Fixes * disabled fields are stripped from the payloadrelates to [#430](#430) ([f0b4319](f0b4319)) * make sure old adapters also work ([cb0bd3f](cb0bd3f)) * onChange can also update other fields ([46dacb9](46dacb9)) * propert handle null valuescloses [#304](#304) ([7d16a4e](7d16a4e)) ### Features * allow to clear <select> field ([19e8db9](19e8db9)), closes [#161](#161) * release ([d21ec77](d21ec77)) * unify flatten unflatten logic ([b8435de](b8435de)), closes [#352](#352)
fixed in 3.1.0 |
Is there any documentation about this? I only now know to use |
I can't edit resources with NULL values that I desire to keep as NULL.
To begin with I receive this Warning in the browser. (From React I suppose)
Then if I try to save after changing only one value it just clears the form. If I want to update I have to fill all the input fields, even the ones I desire to keep NULL.
The text was updated successfully, but these errors were encountered: