Clear a date or time cell in a table

I can't seem to clear a date or time in a table view. I can't delete the text without 1 Jan 1900 or 12:00 being selected.

I thought maybe I could have a custom button to clear a cell but I don't think I can edit the table from the JS query?

Hi @jclutterbuck :wave:

Happy to help you out here with your date issue. To confirm, you're wanting to remove a date in table column? May you share a screenshot of that setup of yours?

I'd advise against editing the table using JS query since it'll most likely revert from the data that which supplies the table in the first place, right? What's the end goal of clearing the date? Maybe we can formulate a workaround together :smile:



Dear @Pawan

Thanks for getting back to me.

I have since realised that I was replacing null values with empty strings when saving new data. I have now changed this but I would still like to be able to clear a cell if, for example, a user has entered data by mistake.

So what I think I'm asking, is for a way to revert a table value in a column of type date or time to null. I agree with your warning about changing the contents of a table only to have it overridden by the source data.

I have a button on the table to delete the entire row, but this seems a bit overkill. I have a button on the container that I wondered if I could use to it to clear the contents of the current cell. Or maybe there should be a way to delete a date or time using the component/widget: e.g. the delete key or a special "clear" option.

Currently, if you delete the entry, it defaults to 12:00 or 1 Jan 1900 instead of null?

On second thoughts, I have other things I'd like to do that might require me to set the values of the table:

For example, when you have products with prices, you need to COPY the values of the price rather than just have them as part of the product (as when the price changes you don't want it to change all the previous products you've sold).

This is similar to what I want to do. I have a list of products and when you choose which product I need to record the price and calculate the VAT and this goes in other cells. What I was hoping to do is have a "Change" event on the product dropdown field but I may be able to use the "Cell change" event. Then I need to put the price in one column and calculate the VAT and put this in another column? I'd rather not add this to the data each time via a query, as it would be MUCH faster to make many changes and then save all the results in a bulk update?

Currently I am updating the product in a form which then updates the data. But this isn't as fast as doing it in the table, which would be a huge advantage.

@Pawan I've got a similar question. I'm creating an app connected to Postgres with a table, where I have some editable fields. A couple of them are date fields, i.e. started_at and ended_at. I'm running bulk update using a DB query. Once I set a date, I can't set it back to null. Clearing the field and changing focus sets the date back.