Null Cells
Null Cells
I have a MySQL table with NULL in cells I do not have any data. DataTables Editor displays the table of NULL cells as empty, which I want.
However, when I add a new row, certain cell columns display "0". Also, if I click on a cell that has for example a "YY" (Ex. 2010) and remove it, I get a 0 instead of a blank cell. How can I keep those cells displaying blank if it is NULL?
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sounds like the database might be configured with a default of
0
for those columns?Allan
I checked. All columns except the Primary Key ("id") are set to NULL. Only the INT defined columns display the 0 when I empty out the cell in the Editor.
I would need a full dump of the SQL and the PHP + JS code you are using if that is possible to try and recreate the issue please.
Allan
Hi Allan,
Here is the zip file of the SQL dump, php and html files and the respective js folders. I kept the path structure within the archive.
http://www.skywateryachts.com/datatables_editor/boats_table.zip
Thank you.
Btw, is there a downloadable manual I can print out?
Thanks.
Coudl you try using the
nullEmpty
set formatter please:for example.
That will have Editor write a
null
value to the database when an empty string is found. It looks like the database is writing0
to the integer field for an empty string.Allan
Thanks Allan, that did the trick. Any idea why the MySQL database/table is writing 0's in just the integer fields? Just for my info, no big deal now that I've got the fix.
This has been all kind of tricky, I'm getting data in the form of a CSV file from another source. So I've had to tip toe through how I set the field values, importing and displaying.
Thanks again.
I suspect it is MySQL trying to be helpful, rather than throwing an error. It is "casting" (for lack of a better term) the empty string to be 00000000....
Allan